1

I am new with react js. I made two components to send/receive data using props between them.

But it gets more complex, I feel like I need to replace them with other solution like redux. I wonder there is the latest better solution to replace redux now for communication between two react components.

jongchul
  • 77
  • 8

2 Answers2

3

There was a lot of opinions between redux and context api like this post. But today, I can say yes, you can replace redux with just react itself. Because, currently react provides so much concepts just like the redux, context api. You can find react additional hooks like useReducer, useCallback, useMemo, etc.

But arguably, redux is still worth for maintaining project easily. You can have redux devtool, keep the code clean (state in store - a separate place for concerns).

There are more concerns over this. You may see this issue what future react will have. You may also find the medium blog helpful and the reddit discussion.


Worth Reading:

State management with react hooks and context api

Bhojendra Rauniyar
  • 83,432
  • 35
  • 168
  • 231
1

Redux main task is to be a 'predictable state container', and, as you wrote, it also makes sharing data between components much easier. The main drawback is that it requires additional code, but I think that it is worth it.

For apps / websites that are not very small, I wouldn't use react / react native without it.

The way redux works may be a bit difficult to understand in the beginning. The following is a great article that helped me when I started using it: redux connect explained

Yossi
  • 5,577
  • 7
  • 41
  • 76