stub reducer hook
This commit is contained in:
parent
5fd4406675
commit
fe474583ef
3 changed files with 27 additions and 1 deletions
|
@ -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
|
||||
|
|
18
src/reducers/stateReducer.js
Normal file
18
src/reducers/stateReducer.js
Normal file
|
@ -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}
|
0
src/reducers/stateReducer.test.js
Normal file
0
src/reducers/stateReducer.test.js
Normal file
Loading…
Reference in a new issue