Ive been learning this and i have to say, react feels like a steaming pile of shit, especially with Redux...

Ive been learning this and i have to say, react feels like a steaming pile of shit, especially with Redux. Everything feels like its forced into a linear design, where you have to design top level components before child components or else itll end up not working. Does anyone agree or is it only because im new to this. Also, making asynchronous api requests to the backend seems much harder than it needs to be. What the fuck is this.

Attached: react.png (1600x537, 81K)

Other urls found in this thread:

mithril.js.org/
github.com/jorgebucaran/hyperapp
medium.com/@dan_abramov/you-might-not-need-redux-be46360cf367
twitter.com/NSFWRedditGif

Your first mistake was adding in the steaming pile of shit known as redux. Lose that and pass your state through props like a man.

In time you'll see the benefits of a modular framework like React.

Also start server side rendering now because it'll be too hard to do later

React > Angular

Any time

See thats exactly what i was thinking. I see absolutely no appeal to using Redux. A global state seems to only make data alot harder to manage. Why would you not compartmentalize and use local states inside components. What is the appeal to redux?

Oh i forgot to add, Im pairing react with a Rails API back end. By server side rendering do you mean using an API to handle JSON responses to update the state and use state to render props in the component? if so, thats kind of what I have been doing.

React forces the browser to execute JavaScript code to build the DOM. SSR is a technique that forces the server to run the JavaScript and send the resulting HTML to the browser. It's an advanced technique so you may want to hold off on that till you get gud

Redux is a meme
If you have some super complex state like a Bloomberg terminal then it may be useful but for 90% of projects it's unneeded complexity

Thats kind of the feeling i have been getting. Its absolutely ridiculous to store data in a global state and then every fucking component needs to dispatch actions and map state to props in order to modify/access that data. I literally dont see a reason why you cant use local states with api get/post requests to retrieve backend data/submit data, or render elements with that data.

Ah thanks. Yea that sounds a bit too advanced for where I'm at now. Im still having trouble remembering to import everything at the top of the file currently lmao. I will look into that though! thanks!

The idea of React+Redux is actually pretty solid. And the whole point of it is that you actually end with a pretty good way to deal with NON-linear design.

Sadly, Redux and React are regrettable awful implementations of the idea. Javascript syntax is too poor to express immutable chart based design on an idiomatic way.

If you want to see what react + redux are actually supposed to be you should learn Elm, seriously, even if you have to go back to work with React, understanding how elm will make react and specially redux click better.

redux was needed to avoid passing through childProps and parentProps up through multiple levels of components to a common parent, now that the context api is official and formalized it's not really needed anymore

You mean Vue > the rest

isn't the rule to use react state until you really feel like you need redux?

>Durrr mine good, other bad durrrrr

Attached: download copy 4.jpg (251x201, 8K)

Probably this.

What is the benefit of this? IF server side need to run JS torender HTML why we don't use PHP or java for better performance?

SSR is only used for the first render- clients don't have to watch a blank page as their js executed, instead they get the home page straight from the server

everything after that is the same as a regular SPA

Can you tl:dr; how things go in Elm and in React (in comparison)? I actually know a bit Elm, but I'd like to know what you can tell me.

Reddit: The Opinion

You are probably designing your React applications wrong.

>you have to design top level components before child components
What a trivial complaint. This is true for any UI framework. Give me a real criticism of React and I'll tell you why your opinion is garbage.

He's just learning.

I recommend mithril.js.org/

I discovered it after trying and becoming frustrated with React and its conventions. Suddenly front-end development was far less cumbersome, and simpler to understand.

State management is honestly something you just have to figure out for yourself. I say, unless you're trying to add Redux to resume, just start with using top-level POJOs to manage state.

For example, keep a `state.js` file in your project root, and just import it where components need access to global state. Add methods that perform complex multi-step state alterations where needed.

Mithril does not include any state management solution, so you could use Redux with it if you want. Mithril's nice because it's minimal and doesn't try to box you into conventions or forced idioms.

If you want a framework that has a more opinionated take on state management without the fluff of React, Hyperapp is nice, but even more minimal than Mithril: github.com/jorgebucaran/hyperapp

maybe its because im using redux but to me it seems annoying to repeatedly have to map global state and dispatch actions to props for each component. Also, im not great with routing yet so maybe thats why i feel its linear. My Login and Registration components have their own routes and components and submit post requests to the backend and change a boolean in the store, and if that boolean is "true" then the container component will render containing elements that pertain to the user. So yes, right now it feels very linear, since everything is going through the login or register form. Im not a React god like you though so im probably just an idiot :^)

The creator of Redux wrote this article essentially saying the same thing you're saying: medium.com/@dan_abramov/you-might-not-need-redux-be46360cf367

Thanks, I think this technique is pretty useless, yes?
If my SPA is simple, user waiting 1s is not matter. If my app complicated enough rendering JS will cost a lot of server power to save, like, 3s from client?

SSR lets your user see content before your bundle with scripts loads. Depending on what your site is supposed to do and how it's designed, it might even allow use without js enabled.

That just makes more sense to me. I feel like the Redux library is very difficult to use. This may be because im new to it, but I feel like theres alot of redundancy and dependency on your index file or whatever renders the react-dom. This is because you have to pass the "store" created by redux to components in order to access them. Further, instead of just being able to call a global constant like "store" to access the state, you need to map it to props to access it, which seems pointless.

Redux is garbage like that. Maybe forcing everything into a boilerplate-heavy pattern like that is a good idea if you have 20+ retarded monkeys struggling to keep their web app together.
If you want to keep the bigger pieces of state away from your component tree without that shit you may want to look into MobX and mobx-react.

>If my app complicated enough rendering JS will cost a lot of server power to save, like, 3s from client?
If the root view is a mostly static page that can be the same for all users you could just cache the HTML and maybe generate a new version every 5 minutes or so _if_ it needs to have semi-realtime updates.