// DECRALER
const ReduxContext = React.createContext(null);
export const ReduxProvider = ({ children }) => {
const [state, dispatch] = React.useReducer(reducer, initParams);
return (
<ReduxContext.Provider value={{ state, dispatch }}>
{children}
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Check to render null/undefined/component. | |
* | |
* Conclusion: `{makeComponent(...)}` is better than `<MakeComponent ... />` because of `undefined` case. | |
*/ | |
const Component = () => { | |
const makeNull = () => null; | |
const makeUndefined = () => undefined; | |
const makeComponent = (props: { item: string }) => ( | |
<div>makeComponent: {props.item}</div> |