ReactJS – Is it better to send a normalized or non-standardized API response for the React REDUX application?

I am writing a react-redux application. At the beginning, it calls a single endpoint, which returns a lot of data in a lot of nested JSON. Then I standardize it and make it Put it in my redux-orm schema.
To me, it seems silly to create nested data in the backend, just to normalize it so that it can be normalized because it comes from a normalized PostgreSQL database.

Database = Normalized --> 
API = Denormalized -->
Frontend = Normalized

The best Is it to send back a normalized API response?

I’m not sure if there is a “good” way. If you have to deal with existing APIs, Then handle it and use a proxy/parser in your front-end code to map your back-end load to your redux-orm store, and the same on the other hand.

In our React/Redux/Redux-orm application Wisembly Jam is produced for nearly a year, I will not pretend to give answers, but provide feedback.

When we started from scratch, we chose to use JsonAPI spec for Our API. We like it because it exposes objects and relationships in a way that suits our PostgreSQL solution, as well as our redux-orm solution.

In this way, neither method requires model relationship nesting , Only ordinary objects processed in the data field, relations included in the included field. It seems to work well together.

You can check our application network tab to see our api works Load response, and our redux-orm storage (using Redux Chrome extension).

I hope it helps, although I didn’t get the correct answer in English:)

p>

I am writing a react-redux application. At the beginning, it calls a single endpoint that returns a lot of data in a lot of nested JSON. Then I normalize it and put it into my redux- In orm mode.
To me, it seems silly to create nested data in the backend, just to normalize it so that it can be normalized because it comes from a normalized PostgreSQL database.

Database = Normalized --> 
API = Denormalized -->
Frontend = Normalized

The best practice is to send back normalized Does the API respond?

I’m not sure if there is a “good” way. If you have to deal with an existing API, then deal with it and use it in your front-end code The proxy/parser maps your backend load to your redux-orm store, and the same is true on the other hand.

In our React/Redux/Redux-orm application Wisembly Jam production Nearly a year later, I will not pretend to give an answer, but provide feedback.

When we started from scratch, we chose to use the JsonAPI spec for our API. We like it because it fits Our PostgreSQL solution exposes objects and relationships, as well as our redux-orm solution.

In this way, the two methods do not require model relationship nesting, only ordinary objects processed in data fields, including The relationship in the include field. It seems to work well together.

You can check our app network tab to see our api payload response, and our redux-orm store (using Redux Chrome extension).

I hope it helps, although I didn’t get the correct answer in English:)

Leave a Comment

Your email address will not be published.