react-native-root-siblings icon indicating copy to clipboard operation
react-native-root-siblings copied to clipboard

with redux

Open chentogit opened this issue 4 years ago • 7 comments

image

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

why?

chentogit avatar May 27 '21 10:05 chentogit

put that line before any component rendering

---Original--- From: @.> Date: Thu, May 27, 2021 18:56 PM To: @.>; Cc: @.***>; Subject: [magicismight/react-native-root-siblings] with redux (#72)

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

why?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.

sunnylqm avatar May 27 '21 11:05 sunnylqm

put that line before any component rendering

Sorry, I still don't get it

image

chentogit avatar May 27 '21 11:05 chentogit

rendering

Is there a simple example to refer to?

The code is here and it has the same error.

image

chentogit avatar May 27 '21 11:05 chentogit

This is right image

sunnylqm avatar May 28 '21 03:05 sunnylqm

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>
  )
}

sunnylqm avatar May 28 '21 03:05 sunnylqm

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>
    )
}

wiseqingyang avatar Aug 06 '21 11:08 wiseqingyang

@wiseqingyang Unfortunately, that wont work

sunnylqm avatar Aug 06 '21 13:08 sunnylqm