D
D
DenimTornado2020-02-22 17:46:29
React
DenimTornado, 2020-02-22 17:46:29

Help with event handling in React/Redux?

Good afternoon, please help with the react / redux bundle. The point is the following. There is a parent component in which I create a store in the form of a two-dimensional matrix. Each of the children corresponds to a cell from the stack. When you click on a cell in the store, the value of the cell changes. The question is how to make each cell "watch" value changes only for itself? If I subscribe via store.subscribe, then ALL cells are re-rendered at once with any change in the store.

Thanks in advance!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
abberati, 2020-02-22
@abberati

Do not use store.subscribe directly - there is a react-redux package for this, it has the optimizations you need. Google towards "memoization of selectors in useSelector"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question