Skip to content

Commit 7ad38bc

Browse files
authored
Fix Issue with react-jss
Quoting from issue verekia#243: At the end of chapter 08, I've got some errors just after src/server/render-app.jsx edit: ``` Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in. Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: undefined. You likely forgot to export your component from the file it's defined in. at invariant (/Users/davidfq/Code/js-stack/node_modules/fbjs/lib/invariant.js:44:15) at ReactCompositeComponentWrapper.instantiateReactComponent [as _instantiateReactComponent] (/Users/davidfq/Code/js-stack/node_modules/react-dom/lib/instantiateReactComponent.js:74:56) ... ``` It seems that <SheetsRegistryProvider> is not available in react-jss v7.1.0. I've just changed it to <JssProvider> and everything worked.
1 parent 7271d32 commit 7ad38bc

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

tutorial/08-bootstrap-jss.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ export const JSS_SSR_SELECTOR = `.${JSS_SSR_CLASS}`
373373
- Edit `src/server/render-app.jsx` like so:
374374

375375
```js
376-
import { SheetsRegistry, SheetsRegistryProvider } from 'react-jss'
376+
import { SheetsRegistry, JssProvider } from 'react-jss'
377377
// [...]
378378
import { APP_CONTAINER_CLASS, JSS_SSR_CLASS, STATIC_PATH, WDS_PORT } from '../shared/config'
379379
// [...]
@@ -383,9 +383,9 @@ const renderApp = (location: string, plainPartialState: ?Object, routerContext:
383383
const appHtml = ReactDOMServer.renderToString(
384384
<Provider store={store}>
385385
<StaticRouter location={location} context={routerContext}>
386-
<SheetsRegistryProvider registry={sheets}>
386+
<JssProvider registry={sheets}>
387387
<App />
388-
</SheetsRegistryProvider>
388+
</JssProvider>
389389
</StaticRouter>
390390
</Provider>)
391391
// [...]

0 commit comments

Comments
 (0)