Ben Gannaway
Ben Gannaway

Reputation: 1083

Redux preventing unnecessary renders

I am rendering a c3 chart which is based on data from two source endpoints, 'characters' and 'interactions'. Because the data comes back separately the chart breaks because it renders twice. Is it possible to create a parent reducer that combines my two reducers so that only one re-render cycle is triggered by this data returning in two parts?

Upvotes: 0

Views: 240

Answers (1)

Exayy
Exayy

Reputation: 618

You could use shouldComponentUpdate from react to wait both source ready.

If you need to create a "readable" data using two "datastore" sources, check reselect library, then in your selector you can return "false" or whatever if one of sources isn't ready.

Good luck

Upvotes: 1

Related Questions