Open danott opened 4 years ago
Was playing around with this. Perhaps it's my inexperience with class components, but I'm unsure of how we can use the new context API with an Array
value without always triggering a re-render. Those docs suggest putting the context into the state solves the problem, but I don't know in which lifecycle method it would be best to update the state.
But maybe none of this is a significant issue if there are no actual changes in the DOM to reconcile.
I'd be inclined to lean into the assumption that React is fast until proven slow.
I'm coming from a background of replacing jQuery("#some-node").html("<div>Some new html!</div>")
with ReactDOM.render(<SomeNewHtml />, document.getElementById("some-node"))
, and I've gotta imagine it can't be worse then it's predecessor? 😆
We're using the legacy context API. It'd be worth modernizing to the latest and greatest React idioms to make this useful into the future.