Skip to content

Commit

Permalink
allow React.Component type argument
Browse files Browse the repository at this point in the history
if pass multi connected components to renderReactRedux(),
required to wrap a element. because react-redux Provider
should enforce a single child.

(e.g.)
renderReactRedux(
  'MyComponent.js',
  <div>
    <ConnectedComponentA />
    <ConnectedComponentB />
  </div>,
  configureStore
);
  • Loading branch information
noriaki committed Jul 7, 2016
1 parent 9865929 commit 2a2cb24
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@ import hypernova, { serialize, load } from 'hypernova';
function buildProvider(connectedComponent, store) {
return (
<Provider store={store}>
{React.createElement(connectedComponent)}
{
React.isValidElement(connectedComponent)
? connectedComponent
: React.createElement(connectedComponent)
}
</Provider>
);
}
Expand Down

0 comments on commit 2a2cb24

Please sign in to comment.