thanks for the neat example. I wonder if you should be wrapping the state creation at the end in a useMemo. Otherwise components that use this hook and render for a reason unrelated to a dice roll will pick up a 'new' dice state and then end up re-rendering some other aspects unnecessarily, e.g. if there is some useMemo call in the calling component with the dice state as one of its inputs.
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.
thanks for the neat example. I wonder if you should be wrapping the state creation at the end in a useMemo. Otherwise components that use this hook and render for a reason unrelated to a dice roll will pick up a 'new' dice state and then end up re-rendering some other aspects unnecessarily, e.g. if there is some useMemo call in the calling component with the dice state as one of its inputs.