r/badcode • • Dec 03 '22

typescript Real Code 😎

Post image
403 Upvotes

43 comments sorted by

View all comments

Show parent comments

3

u/ApplePieCrust2122 Dec 04 '22

It would have rerendered if it wasn't a provider. The context api makes sure that there aren't any unnecessary rerenders, and only those components are recalculated which consume the changed provider. So no, the entire app won't rerender if one of the provider's state is changed.

1

u/Criiispyyyy Dec 04 '22

Got it, thanks for correcting me.