Hacker News new | ask | show | jobs
by Nekorosu 3230 days ago
Somehow author jumps from the problem of convenient data structures updating and immutability to Redux which solves a different problem.

There are several things about React, Redux and React based tech stacks:

1. React requires knowledge of basics of functional programming

React looks like it's easy to pick up but if you don't know or want to learn at least basics of functional programming then it's not for you. Without this knowledge, a lot of things will be a struggle and won't make any sense. You'll mess up pretty bad. React requires the understanding of its principles which require the understanding of FP essentials.

2. React is not a framework and does only one thing well

It does only one thing well, turning your UI into a function of data. Yes, there is a virtual DOM but it's an implementation detail and not the purpose of React. If you think about it everything which is there is needed to make that UI=F(data) possible. However, it's enough for simple apps.

Immutability isn't always needed so it's optional. It's not built into JS, you'll have to use an additional library.

3. Building non-trivial apps requires a lot of knowledge and experience

Building non-trivial apps with React only is a pain. That's expected because the only thing it does is making a UI a function of data. It's not a framework with a complete set of tools and practices for building a whole SPA. That means you have to assemble your own tech stack for your particular task. This requires a lot of experience but lets you have the tools which are a better fit for your app.

Redux is just one of the available choices for solving the problem of complex app's architecture. It isolates state from React components. UI interaction with the outer world is behind actions. Data access is behind selectors. State mutations are centralized in reducers. This is very convenient, you always know where to look for something. Business logic part is very clear because of actions and reducers. Not messing everything up requires knowledge and discipline though.

The funny thing is React+Redux isn't a complete framework. For case, there are several solutions for writing asynchronous actions.

The main idea is React is ok to use by itself for simple things. You don't need to know much except FP essentials. Using more advanced React based tech stacks requires much more knowledge and experience.

If you don't know which of your problems React solves you don't need it.

If you don't know which of your problems immutability solves you don't need it.

If you don't know which of your problems Redux solves you don't need it.

1 comments

I completely agree here. and I think if most people followed these last 3 lines, there might be what, 6 projects using React?

I find the highlighted article on Facebook's "reason" for inventing Flux/Redux very laughable. - This message unread indicator kept saying (1). And how it went away with bug fixes and came back...

Did they ever stop to realize they just had some really bad devs working on the chat app? Any re-write, whether they had to invent flux or not would have fixed that indicator. It's a false story.

Much more than six projects for sure. Nice pun though. I started using React before the hype train. I couldn't care less about Facebook's reasons but I enjoy the fact they somehow built a library which is a good fit for some of my projects.

I don't like Redux that much. All React based frameworks I like are not even written in JavaScript.