Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

with redux #72

Open
chentogit opened this issue May 27, 2021 · 7 comments
Open

with redux #72

chentogit opened this issue May 27, 2021 · 7 comments

Comments

@chentogit
Copy link

image

report: Error: could not find react-redux context value; please ensure the component is wrapped in a <Provider>

why?

@sunnylqm
Copy link
Collaborator

sunnylqm commented May 27, 2021 via email

@chentogit
Copy link
Author

put that line before any component rendering

Sorry, I still don't get it

image

@chentogit
Copy link
Author

chentogit commented May 27, 2021

rendering

Is there a simple example to refer to?

The code is here and it has the same error.

image

@sunnylqm
Copy link
Collaborator

This is right
image

@sunnylqm
Copy link
Collaborator

sunnylqm commented May 28, 2021

But you need 2 providers, one for main app, one for rootsiblings.

setSiblingWrapper(
   //  This provider is for elements inside root-siblings
)

const App = () => {
  // This rendering function will invoke frequently. So *DO NOT* put any one-time use function here. 
  return (
              <RootSiblingParent>
                <Provider  
                   // .......
                   //  This provider is for elements not inside root-siblings
                    >
                 <App />
                </Provider>
              </RootSiblingParent>
  )
}

@wiseqingyang
Copy link

But you need 2 providers, one for main app, one for rootsiblings.

setSiblingWrapper(
   //  This provider is for elements inside root-siblings
)

const App = () => {
  // This rendering function will invoke frequently. So *DO NOT* put any one-time use function here. 
  return (
              <RootSiblingParent>
                <Provider  
                   // .......
                   //  This provider is for elements not inside root-siblings
                    >
                 <App />
                </Provider>
              </RootSiblingParent>
  )
}

so there is another way seems more simpler:

render() {
    return (
        <Provider store={store}>
             <RootSiblingParent>
                     <App />
             </RootSiblingParent>
        </Provider>
    )
}

@sunnylqm
Copy link
Collaborator

sunnylqm commented Aug 6, 2021

@wiseqingyang Unfortunately, that wont work

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants