diff --git a/src/PhonoChangeApplier.js b/src/PhonoChangeApplier.js index d869441..532c298 100644 --- a/src/PhonoChangeApplier.js +++ b/src/PhonoChangeApplier.js @@ -1,4 +1,4 @@ -import React, { useState, useEffect } from 'react'; +import React, { useState, useReducer } from 'react'; import './PhonoChangeApplier.scss'; // import ls from 'local-storage'; @@ -9,7 +9,15 @@ import Epochs from './components/Epochs'; import Options from './components/Options'; import Output from './components/Output'; +import {initState, stateReducer} from './reducers/stateReducer'; + const PhonoChangeApplier = () => { + const [ state, dispatch ] = useReducer( + stateReducer, + {}, + initState + ) + const [ lexicon, setLexicon ] = useState(['mun', 'tʰu', 'tɯm', 'utʰ']); const [ phonemes, setPhonemes ] = useState( // ! candidate for trie to avoid situations where >2 graph phonemes diff --git a/src/reducers/stateReducer.js b/src/reducers/stateReducer.js new file mode 100644 index 0000000..e2a4923 --- /dev/null +++ b/src/reducers/stateReducer.js @@ -0,0 +1,18 @@ +const initState = () => { + return { + + } +} + +const stateReducer = (state, action) => { + switch (action.type) { + case 'INIT': { + return initState(); + } + + default: + return state; + } +} + +module.exports = {initState, stateReducer} \ No newline at end of file diff --git a/src/reducers/stateReducer.test.js b/src/reducers/stateReducer.test.js new file mode 100644 index 0000000..e69de29