Skip to content

Commit 1594759

Browse files
committed
Add additional copy to explain demos
1 parent ea32b44 commit 1594759

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

docs/introduction.mdx

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,15 @@ sidebar_position: 1
33
slug: /
44
---
55

6-
import { DemoLiveEditor } from '../website/src/components/live-edit'
6+
import { DemoLiveEditor } from "../website/src/components/live-edit";
77

88
# Introduction
99

10-
**React Live** brings you the ability to render React components with editable source code and live preview.
10+
**React Live** brings you the ability to render React components with editable source code and live preview. React Live is structured modularly and lets you style and compose its components freely. The following demos show typical use cases including the editor, preview, and error pane components. To see React Live in action make changes to the following editor panes below.
1111

12-
The library is structured modularly and lets you style and compose its components freely.
12+
### Inline Demo
1313

14-
15-
### Basic Demo
14+
React Live by default takes a block of JSX and renders it in the preview as if it were returned from a functional component. A header component represented in JSX is rendered as shown below with the style props.
1615

1716
export const jsxExample = `
1817
<h3 style={{
@@ -27,7 +26,10 @@ export const jsxExample = `
2726

2827
<DemoLiveEditor code={jsxExample} />
2928

30-
### No Inline Demo
29+
### Render-function Demo
30+
31+
To render a series of components or render components beyond just JSX, React Live also provides a `render` function to pass JSX into when the `noInline` prop is present. This lets you render multiple or functional components with hooks. This example shows a functional component with a `useState` hook.
32+
3133
export const noInlineExample = `
3234
const Counter = () => {
3335
const [count, setCount] =
@@ -57,6 +59,9 @@ render(<Counter />)
5759
<DemoLiveEditor code={noInlineExample} noInline />
5860

5961
### Syntax Error Demo
62+
63+
React Live can also display customizable errors when your code contains errors.
64+
6065
export const syntaxError = `
6166
const badVariable = ;
6267
`.trim();

package.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,10 @@
1616
"prepublishOnly": "npm run build",
1717
"test": "jest",
1818
"test:typings": "typings-tester --dir typings",
19-
"lint": "eslint --config .eslintrc \"./**/*.js\""
19+
"lint": "eslint --config .eslintrc \"./**/*.js\"",
20+
"install:docs": "yarn --cwd website install",
21+
"start:docs": "yarn --cwd website start",
22+
"build:docs": "yarn --cwd website build"
2023
},
2124
"dependencies": {
2225
"prism-react-renderer": "^1.3.1",

website/src/components/live-edit.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { LiveProvider, LiveEditor, LiveError, LivePreview } from "react-live";
44
export const DemoLiveEditor = ({ noInline, code }) => {
55
return (
66
<LiveProvider code={code} noInline={noInline}>
7-
<div className="grid grid-cols-2 gap-4">
7+
<div className="grid lg:grid-cols-2 gap-4">
88
<LiveEditor className="font-mono" />
99
<LivePreview />
1010
</div>

0 commit comments

Comments
 (0)