// src/components/AppProviders.js export default function AppProviders({ children }) { return ( <Context1 value={value}> <Context2 value={value2}> <Context3 value={value3}>{children}</Context3> </Context2> </Context1> ); }
// src/index.js import ReactDOM from "react-dom"; import App from "./App"; import AppProviders from './components/AppProviders' const rootElement = document.getElementById("root"); ReactDOM.render( <AppProviders> <App /> </AppProviders>, rootElement );
Agree.
This looks way cleaner IMO. Keep it simple and easy to read.
Exactly. No point digging into internals when you can just import.
Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment's permalink.
Hide child comments as well
Confirm
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Agree.
This looks way cleaner IMO. Keep it simple and easy to read.
Exactly. No point digging into internals when you can just import.