2020-01-16 10:18:40 +01:00
|
|
|
import React, {useState} from "react"
|
|
|
|
|
|
|
|
|
|
const MorseBufferContext = React.createContext()
|
|
|
|
|
|
|
|
|
|
function MorseBufferContextProvider(props) {
|
2020-01-17 21:23:17 +01:00
|
|
|
|
2020-01-16 10:18:40 +01:00
|
|
|
const [morseCharBuffer, setMorseCharBuffer] = useState('')
|
|
|
|
|
const [morseWords, setMorseWords] = useState([])
|
2020-01-17 10:29:24 +01:00
|
|
|
|
2020-01-16 10:18:40 +01:00
|
|
|
return (
|
|
|
|
|
<MorseBufferContext.Provider value={{
|
|
|
|
|
morseCharBuffer: morseCharBuffer,
|
|
|
|
|
morseWords: morseWords,
|
|
|
|
|
setMorseCharBuffer: setMorseCharBuffer,
|
|
|
|
|
setMorseWords: setMorseWords
|
|
|
|
|
}}>
|
|
|
|
|
{props.children}
|
|
|
|
|
</MorseBufferContext.Provider>
|
|
|
|
|
)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export {MorseBufferContextProvider, MorseBufferContext}
|