DEV Community

Discussion on: Emulate Redux with React hooks

Collapse
 
budarin profile image
Вадим Бударин • Edited

for the emulating reselect

const { state, dispatch } = useContext(ReducerContext);
const counter = useMemo(() => state.counter, [state.counter])

how to avoid re rendering every time the state is changed only when the particular slice of the state is changed?

Collapse
 
terrierscript profile image
terrierscript

Oh, I did not know about that behavior.I will try to find out about it.