3 ms·
Keep your server-side interactions (aka state) outside of the scope of your components and pass in data as properties. There is an intrinsic connection between
by williamcotton 12y ago
Keep your server-side interactions (aka state) outside of the scope of your components and pass in data as properties.
There is an intrinsic connection between state and external environment that must be grasped before you can start building isomorphic modules.
I'm not sure why jQuery and React would ever be used in the same project. If you want an isomorphic solution to retrieving data check out https://www.npmjs.com/package/browser-request https://www.npmjs.com/package/browser-request and enable and convince 3rd parties to enable CORS on HTTP endpoints.
- Todd 12y agoYou make valid points and, in general, the top-down prop passing convention is the recommended approach with React. This works well if most of your state can be managed client-side with, e.g., Flux stores. There are some cases, though, such as large scale paginated data sets, that require out-of-band requests to a service (even if they are managed through stores). This is the case that's problematic. For these components, I just render out scaffolding and a loading indicator. Thanks for the recommendation. The only reason for jQuery is the occasional external dependency and the XHR wrapper.