Skip to content
Toggle navigation
Toggle navigation
This project
Loading...
Sign in
brainfood
/
astro-redux
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Issue Boards
Files
Commits
Network
Compare
Branches
Tags
b37eee96
authored
2024-05-03 14:49:45 -0500
by
Adam Heath
Browse Files
Options
Browse Files
Tag
Download
Email Patches
Plain Diff
Copy defaultProps, displayName, and propTypes from the wrapped
component.
1 parent
10578956
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
1 deletions
src/react.jsx
src/react.jsx
View file @
b37eee9
...
...
@@ -4,7 +4,8 @@ import "use-sync-external-store/with-selector.js"
import
{
Provider
}
from
'react-redux'
import
{
getBrowserStore
}
from
'./client.mjs'
export
const
ReduxAstroProvider
=
(
Component
)
=>
(
props
)
=>
{
export
const
ReduxAstroProvider
=
(
Component
)
=>
{
const
Wrapped
=
(
props
)
=>
{
const
{
ASTRO_STORE
:
possibleStore
=
{},
...
rest
...
...
@@ -14,4 +15,9 @@ export const ReduxAstroProvider = (Component) => (props) => {
return
(
<
Provider
store=
{
store
}
><
Component
{
...
rest
}
/></
Provider
>
)
}
if
(
Component
.
defaultProps
)
Wrapped
.
defaultProps
=
Component
.
defaultProps
if
(
Component
.
propTypes
)
Wrapped
.
propTypes
=
Component
.
propTypes
if
(
Component
.
displayName
)
Wrapped
.
displayName
=
Component
.
displayName
return
Wrapped
}
...
...
Please
register
or
sign in
to post a comment