rookLab / react-component-caching

Speedier server-side rendering with component caching in React 16
388 stars 26 forks source link

How use lib with redux? #50

Closed anagami closed 5 years ago

anagami commented 5 years ago

Hi I try integrate lib with my react+redux app when i call

  const reactDom = await ReactCC.renderToString(
    <Provider store={store}>
      <StaticRouter location={req.url} context={context}>
        <Root />
      </StaticRouter>
    </Provider>,
    cache
  );

i got error

TypeError: element.type.toLowerCase is not a function
    at ReactDOMServerRenderer.renderDOM (node_modules\react-component-caching\development.js:2473:28)
    at ReactDOMServerRenderer.render (node_modules\react-component-caching\development.js:2466:21)
    at ReactDOMServerRenderer.read (node_modules\react-component-caching\development.js:2336:21)
    at Object.renderToString (node_modules\react-component-caching\development.js:2673:31)
    at renderResponse (www\server.js:44:57)
    at Promise.all.then.catch.e (www\server.js:92:7)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:188:7)

it happened when this line https://github.com/rookLab/react-component-caching/blob/master/src/server/ReactPartialRenderer.js#L794 try read type property for Provider