Does React Context/Providers inherently cause lower perf or only if it reloads a lot of components?

I'm creating a Switch component and want to pass the enabled state to the thumb component via a Provider. For some reason I have this belief that using Providers are a heavy solution that causes performance issues, but maybe that's only when it's at the top of the app and causes a ton of components to rerender. If I use a Provider in a switch, and say there are like 10-20 switches in a form, will that inherently cause performance issues because of all the context and providers created, or is a provider just another tool and it's fine to use if it doesn't rerender a hundred components on change? The alternative is to require the developer using the switch to pass the enabled prop down manually to the thumb. Is one more or less performance than the other or is this stuff negligible and I can use providers in primitive components (Switch, Button, Tooltips) and it won't effect performance much at all?
0 Replies
No replies yetBe the first to reply to this messageJoin
Want results from more Discord servers?
Add your server