b37eee96 by Adam Heath

Copy defaultProps, displayName, and propTypes from the wrapped

component.
1 parent 10578956
...@@ -4,7 +4,8 @@ import "use-sync-external-store/with-selector.js" ...@@ -4,7 +4,8 @@ import "use-sync-external-store/with-selector.js"
4 import { Provider } from 'react-redux' 4 import { Provider } from 'react-redux'
5 import { getBrowserStore } from './client.mjs' 5 import { getBrowserStore } from './client.mjs'
6 6
7 export const ReduxAstroProvider = (Component) => (props) => { 7 export const ReduxAstroProvider = (Component) => {
8 const Wrapped = (props) => {
8 const { 9 const {
9 ASTRO_STORE: possibleStore = {}, 10 ASTRO_STORE: possibleStore = {},
10 ...rest 11 ...rest
...@@ -14,4 +15,9 @@ export const ReduxAstroProvider = (Component) => (props) => { ...@@ -14,4 +15,9 @@ export const ReduxAstroProvider = (Component) => (props) => {
14 return ( 15 return (
15 <Provider store={store}><Component {...rest}/></Provider> 16 <Provider store={store}><Component {...rest}/></Provider>
16 ) 17 )
18 }
19 if (Component.defaultProps) Wrapped.defaultProps = Component.defaultProps
20 if (Component.propTypes) Wrapped.propTypes = Component.propTypes
21 if (Component.displayName) Wrapped.displayName = Component.displayName
22 return Wrapped
17 } 23 }
......