DEV Community

Discussion on: React: Controlling Rendering Through Keys

ganderzz profile image
Dylan Paulus Author

Agreed, good point Nick. This should be used as a last resort or in special cases.

In my case, we needed to reload the entire page due to a change in where the API lives. Data can come from either a 'global' or 'local' source, and the user has the ability to switch between the two. Most of our API calls live in componentDidMount(), so there is no easy way of re-sending all the page's API calls without a rerender. Something like Redux could of helped, but would cause a huge rewrite.