R
R
rshruslan2020-01-19 19:35:43
JavaScript
rshruslan, 2020-01-19 19:35:43

How to take out the logic from layout?

I have a React project where I use hooks, so the components are functions, not classes.
How can you take logic out of layout?
Earlier, when I used class components, I did it with the help of HOC.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
abberati, 2020-01-19
@rshruslan

Write custom hooks, organize logic in them. You have useSelector and useDispatch in redux.
Hooks allow you to do exactly the same thing that hoks allow you to do, but more compactly and without generating unnecessary wrapper components.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question