N
N
NarkoMan012021-06-09 18:03:53
React
NarkoMan01, 2021-06-09 18:03:53

Which is better to use Redux or Context?

What are the benefits of redux/context?
And what is now better to choose for global storage?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Max, 2021-06-09
@NarkoMan01

TLDR: It's best to use whatever suits the specific needs of your application.
In a simple application, context will do. The application will start to grow, the context will not be enough, you will start to wind up the logic. You will get your redux at the minimum, but most likely with a worse implementation.
Naked redax in 2021 is better not to take. Look directly towards redux-toolkit. If you need a "store" for the data cache from the web server, it makes sense to look at the redux-toolkit query, just a week since they released it.
Good article on this topic: https://blog.isquaredsoftware.com/2021/01/context-...

A
Anton Romankov, 2021-06-17
@romant094

Lots of articles on this topic. Here is one of them: https://habr.com/ru/post/419449/
But in general, as correctly noted above, it depends on the goals.
Both approaches have both pros and cons.
I would answer the question like this: if the project is small (like a todo list), then context. If it is large, then you need a centralized state manager.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question