stub reducer hook

This commit is contained in:
Sorrel Bri 2019-12-04 14:25:16 -08:00
parent 5fd4406675
commit fe474583ef
3 changed files with 27 additions and 1 deletions

View file

@ -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

View 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}

View file