There are two built-in hooks, useState and useReducer.
A Grid-based state using either useState or useReducer (useState internally uses useReducer). .
If you have other states such as loading, score, win/loss to be updated at the same time as the grid-based state changes, you might want to use useReducer, as it lets you update multiple states at once.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Hi Tri.
React is "state" driven. When you think of using
forceUpdate, you are making changes to internal maze state and trying to re-render the component.What you have to do is to put maze state in hooks or in
stateobject. Changing the reference of the state should re-render.I'm new to React. Which hook should I be utilizing if I'm doing something Grid-based?
There are two built-in hooks,
useStateanduseReducer.A Grid-based state using either
useStateoruseReducer(useStateinternally usesuseReducer). .If you have other states such as loading, score, win/loss to be updated at the same time as the grid-based state changes, you might want to use
useReducer, as it lets you update multiple states at once.