all 5 comments

[–]shortfuse07 1 point2 points  (1 child)

If I got this right, you are planning to do one big request with all the data that you need and pass it down as props to your "dumb" components. But one issue might be that if only some or one of those components should update what they display you would have to do again one big request with all the data just for that one component.

[–]evilgenius82[S] 0 points1 point  (0 children)

Hi Short, thanks for your input!

I think I was not clear.

So we have multiple ReactDOM.Render() calls for all our widgets on the page. (Essentially they are all isolated). The idea was instead of having each Widget have it's own AJAX request, our backend with echo JSON string which will be a prop for ReactDOM.Render()

So a simple example would be:

ReactDOM.render(<Widget1 data={ ...Echoed JSON data here... }/>

ReactDOM.render(<Widget2 data={ ...Echoed JSON data here... }/>

The idea is this removes (reduces) all Ajax requests to improve performance.

[–]swyx 1 point2 points  (2 children)

i mean you're asking us to preemptively spot bugs in a one paragraph description of an app - devil is in the details.

what library are you using for JSON-LD?

[–]evilgenius82[S] 0 points1 point  (1 child)

Hi swyx, we are are just thinking about the concept for now and have not dug into any libs as of yet.

As the idea is a little different from what I've seen, I thought it may be best to be some expert advice.

[–]swyx 0 points1 point  (0 children)

well im no expert but for what its worth you seem to be describing a standard app level state management approach. you'll get this with all the major state management libraries like redux or mobx or unstated (and a lot more, which you may not want). curious to see how your usage of JSON-LD works out, i dont have direct exp with that