4 ms·
No. The redux <Provider> component is just a simple React context that uses `children` [1]: <Context.Provider value={contextValue}>{children}</Context.Provide
by HarmonicTons 4y ago
No. The redux <Provider> component is just a simple React context that uses `children` [1]:
<Context.Provider value={contextValue}>{children}</Context.Provider>
And `children` behave diferently. `children` is a prop and thus not considered as an element of the Provider component, but of the App component [2]. Meaning the components inside `children` will rerender when App renders, and not when Provider renders.
1: https://github.com/reduxjs/react-redux/blob/master/src/components/Provider.tsx#L61 https://github.com/reduxjs/react-redux/blob/master/src/compo...
2: https://www.developerway.com/posts/react-elements-children-parents https://www.developerway.com/posts/react-elements-children-p...