react.jsx
401 Bytes
import React from 'react'
import { Provider } from 'react-redux'
import { getBrowserStore } from './client.mjs'
export const ReduxAstroProvider = (Component) => (props) => {
const {
ASTRO_STORE: possibleStore = {},
...rest
} = props
const store = possibleStore.dispatch ? possibleStore : getBrowserStore()
return (
<Provider store={store}><Component {...rest}/></Provider>
)
}