Using Redux all over is an anti-pattern – why?

I am attending quite a few job interviews these day and we sometimes we discuss React and Redux.

I was presented with the idea of using Redux «all over». To me that sounds like you have no attributes in your components and connect to redux in every component all over your solution.

This is not the way to go. Creating components that takes attributes is the core to Web Components. It is based on the mindset of all of the web and the work of WHATVG and html standard. It makes your component readable and reusable.

You don’t want to connect to Redux store in all of your components. Connect in the container and propagate to your components using props.

An example I discussed in an interview today was a todolist.

See code below…

EDIT: The pastebin is incomplete and one problem in the code is the iteration sequence – the number in row of todolistitems needs to be propagated in my anti-pattern.

The point is – any kind of component that takes data should receive them as attributes/properties. I was just introduced to the idea of using Redux «everywhere» in an interview and my point is that you do not have to connect every component to redux. This will even make your code slower (perhaps) – you iterate over the array and you do not access the values in the loop.

This is really sigletonitis all over again – as a disease where you over-use a pattern. Just on Redux or whatever datastore you might implement.


Legg igjen en kommentar

Din e-postadresse vil ikke bli publisert. Obligatoriske felt er merket med *