Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 140500

Assign prop values when doing a default export in ReactJS

$
0
0

I am having such a pain with such a small issue. I am integrating Launch Darkly which takes a certain number of parameters for it work during the export. My export is as follows:

export default withLDProvider({
    clientSideID,
    user: {
      key: userId,
      custom: {
        siteId: site,
      },
    },
  })(App);

Now, clientSideID, userId, and site are part of my props which i need to assign to it.

I have tried the following:

export default (props) => {
  const { auth: { userId, site } } = props.store.getState();

  return withLDProvider({
    clientSideID,
    user: {
      key: userId,
      custom: {
        siteId: site,
      },
    },
  })(App);
};

but i get the following error:

index.js:2178 Warning: Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it.
    in Component (created by Connect(Component))
    in Connect(Component) (created by HotExportedConnect(Component))
    in AppContainer (created by HotExportedConnect(Component))
    in HotExportedConnect(Component) (at src/index.js:33)
    in ErrorBoundary (at src/index.js:33)

help?


Viewing all articles
Browse latest Browse all 140500

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>