Skip to content

Instantly share code, notes, and snippets.

View snamiki1212's full-sized avatar

snamiki1212 snamiki1212

View GitHub Profile
/**
* 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>
// DECRALER
const ReduxContext = React.createContext(null);
export const ReduxProvider = ({ children }) => {
  const [state, dispatch] = React.useReducer(reducer, initParams);
  return (
    <ReduxContext.Provider value={{ state, dispatch }}>
      {children}