soundslikebliss
soundslikebliss

Reputation: 111

React and UI updates on data changes (via backend)

Learning a little React currently. I'm finding myself confused about some of the utility here. One sticking point that seems to (for me, at least) undermine it's value is that If I want to sync my UI to data residing on the server (which can and will change), I need to manually poll the server? Aside from component-based architecture, I'm not sure how this is getting me further than well structured and logically implemented AJAX. Even in the React docs, they're using JQuery in this regard. https://facebook.github.io/react/docs/tutorial.html#updating-state

I'm sure I'm missing the forest for the trees or whatever. Thanks!

Upvotes: 3

Views: 3890

Answers (1)

Pawel Zubrycki
Pawel Zubrycki

Reputation: 2713

React is (citing their page)

a javascript library for building user interfaces

The main focus is to build a view layer for your application. This means you have full freedom in choosing what to use to fetch your data. For simple uses it can be jQuery or fetch.

It's generally recommended to not fetch data directly in your components and use one of Flux pattern implementations, e.g. Redux.

If your application has to be constantly powered by new data from server you can think about using something like RethinkDB on your backend and connect it to Flux store on your frontend.

Upvotes: 4

Related Questions