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
Our reported bundle size badges don't give you the full picture of
@@ -178,16 +169,15 @@ Sucrase for transpilation.
178
169
This component provides the `context` for all the other ones. It also transpiles the user’s code!
179
170
It supports these props, while passing any others through to the `children`:
180
171
181
-
|Name|PropType|Description|
182
-
|---|---|---|
183
-
|code|PropTypes.string|The code that should be rendered, apart from the user’s edits
184
-
|scope|PropTypes.object|Accepts custom globals that the `code` can use
185
-
|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}`
186
-
|transformCode|PropTypes.func|Accepts and returns the code to be transpiled, affording an opportunity to first transform it
187
-
|language|PropTypes.string|What language you're writing for correct syntax highlighting. (Default: `jsx`)
188
-
|disabled|PropTypes.bool|Disable editing on the `<LiveEditor />` (Default: `false`)
189
-
|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 |
175
+
| scope | PropTypes.object | Accepts custom globals that the `code` can use |
176
+
| 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}`|
177
+
| transformCode | PropTypes.func | Accepts and returns the code to be transpiled, affording an opportunity to first transform it |
178
+
| language | PropTypes.string | What language you're writing for correct syntax highlighting. (Default: `jsx`) |
179
+
| disabled | PropTypes.bool | Disable editing on the `<LiveEditor />` (Default: `false`) |
180
+
| theme | PropTypes.object | A `prism-react-renderer` theme object. See more [here](https://github.com/FormidableLabs/prism-react-renderer#theming)|
191
181
192
182
All subsequent components must be rendered inside a provider, since they communicate
193
183
using one.
@@ -200,10 +190,10 @@ with valid JSX elements.
200
190
201
191
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).
202
192
203
-
|Name|PropType|Description|
204
-
|---|---|---|
205
-
|style|PropTypes.object|Allows overriding default styles on the `LiveEditor` component.
| code | PropTypes.string | Reflects the code that is passed in as the `code` prop |
226
+
| error | PropTypes.string | An error that the code has thrown when it was previewed |
227
+
| onError | PropTypes.func | A callback that, when called, changes the error to what's passed as the first argument |
228
+
| onChange | PropTypes.func | A callback that accepts new code and transpiles it |
229
+
| element | React.Element | The result of the transpiled code that is previewed |
242
230
243
231
> Note: The code prop doesn't reflect the up-to-date code, but the `code` prop, that is passed to the `LiveProvider`.
244
232
245
-
246
233
## FAQ
247
-
> **I want to use experimental feature x but Sucrase doesn't support it! Can I use babel instead?**
248
-
249
-
`react-live` doesn't currently support configuring the transpiler and it ships with Sucrase. The current workaround for using some experimental features `Sucrase` doesn't support would be to use the `transformCode` prop on `LiveProvider` to transform your code with `babel` alongside `Sucrase`.
250
234
235
+
> **I want to use experimental feature x but Sucrase doesn't support it! Can I use babel instead?**
251
236
237
+
`react-live` doesn't currently support configuring the transpiler and it ships with Sucrase. The current workaround for using some experimental features `Sucrase` doesn't support would be to use the `transformCode` prop on `LiveProvider` to transform your code with `babel` alongside `Sucrase`.
252
238
253
239
## Comparison to [component-playground](https://github.com/FormidableLabs/component-playground)
254
240
@@ -269,5 +255,4 @@ Here are the various factors at play:
269
255
270
256
## Maintenance Status
271
257
272
-
**Active:** Formidable is actively working on this project, and we expect to continue for work for the foreseeable future. Bug reports, feature requests and pull requests are welcome.
273
-
258
+
**Active:** Formidable is actively working on this project, and we expect to continue for work for the foreseeable future. Bug reports, feature requests and pull requests are welcome.
0 commit comments