You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
| code |`PropTypes.string`| The code that should be rendered, apart from the user’s edits |
15
-
| scope |`PropTypes.object`| Accepts custom globals that the `code` can use |
16
-
| noInline |`PropTypes.bool`| Doesn’t evaluate and mount the inline code (Default: `false`). Note: when using `noInline` whatever code you write must be a single expression (function, class component or some `jsx`) that can be returned immediately. If you'd like to render multiple components, use `noInline={true}`|
17
-
| transformCode |`PropTypes.func`| Accepts and returns the code to be transpiled, affording an opportunity to first transform it|
18
-
| language |`PropTypes.string`| What language you're writing for correct syntax highlighting. (Default: `jsx`) |
19
-
| enableTypeScript |`PropTypes.bool`| Enables TypeScript support in transpilation. (Default: `true`) |
20
-
| disabled |`PropTypes.bool`| Disable editing on the `<LiveEditor />` (Default: `false`) |
21
-
| theme |`PropTypes.object`| A `prism-react-renderer` theme object. See more [here](https://github.com/FormidableLabs/prism-react-renderer#theming)|
| code |`PropTypes.string`| The code that should be rendered, apart from the user’s edits |
15
+
| scope |`PropTypes.object`| Accepts custom globals that the `code` can use |
16
+
| noInline |`PropTypes.bool`| Doesn’t evaluate and mount the inline code (Default: `false`). Note: when using `noInline` whatever code you write must be a single expression (function, class component or some `jsx`) that can be returned immediately. If you'd like to render multiple components, use `noInline={true}`|
17
+
| transformCode |`PropTypes.func`| Accepts and returns the code to be transpiled, affording an opportunity to first transform it. Synchronous transforms participate in the initial server render, while asynchronous transforms defer preview output until hydration.|
18
+
| language |`PropTypes.string`| What language you're writing for correct syntax highlighting. (Default: `jsx`) |
19
+
| enableTypeScript |`PropTypes.bool`| Enables TypeScript support in transpilation. (Default: `true`)|
20
+
| disabled |`PropTypes.bool`| Disable editing on the `<LiveEditor />` (Default: `false`) |
21
+
| theme |`PropTypes.object`| A `prism-react-renderer` theme object. See more [here](https://github.com/FormidableLabs/prism-react-renderer#theming)|
22
22
23
23
All subsequent components must be rendered inside a provider, since they communicate
24
24
using one.
@@ -27,6 +27,8 @@ The `noInline` option kicks the Provider into a different mode, where you can wr
27
27
code and nothing gets evaluated and mounted automatically. Your example will need to call `render`
28
28
with valid JSX elements.
29
29
30
+
`LiveProvider` can also render the initial preview during SSR as long as the example can be evaluated synchronously. That includes the default inline mode and `noInline` examples that call `render(...)` during evaluation. If `transformCode` returns a Promise, the preview stays empty on the server and is filled in after hydration.
31
+
30
32
### `<LiveEditor />`
31
33
32
34
This component renders the editor that displays the code. It is a wrapper around [`react-simple-code-editor`](https://github.com/satya164/react-simple-code-editor) and the code highlighted using [`prism-react-renderer`](https://github.com/FormidableLabs/prism-react-renderer).
0 commit comments