Don't use JSX

context-store
Alfred Melch 5 years ago
parent 6fbca8a306
commit 3255c42253

@ -19,7 +19,7 @@ export const createStore = storeDef => {
const context = createContext(null) const context = createContext(null)
const Provider = ({ children }) => { const Provider = ({ children }) => {
const store = useReducerStore(storeDef) const store = useReducerStore(storeDef)
return <context.Provider value={store}>{children}</context.Provider> return React.createElement(context.Provider, { value: store }, children)
} }
const useStore = () => useContext(context) const useStore = () => useContext(context)
return { Provider, Consumer: context.Consumer, useStore } return { Provider, Consumer: context.Consumer, useStore }

Loading…
Cancel
Save