Skip to content

Commit

Permalink
doc: Update README.md (#214).
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Apr 22, 2022
1 parent fa2c5c8 commit 06b310f
Showing 1 changed file with 27 additions and 2 deletions.
29 changes: 27 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,19 +21,44 @@ npm install @uiw/react-code-preview --save

[![Open in CodeSandbox](https://img.shields.io/badge/Open%20in-CodeSandbox-blue?logo=codesandbox)](https://codesandbox.io/embed/polished-surf-t6ro9?fontsize=14&hidenavigation=1&theme=dark)

### In React 18

```jsx
import Button from '@uiw/react-button';
import CodePreview from '@uiw/react-code-preview';

const code = `import Button from '@uiw/react-button';
import ReactDOMClient from 'react-dom/client';
ReactDOM.render(
<div>
<Button type="primary">主要按钮</Button>
<Button type="success">成功按钮</Button>
</div>,
_mount_
);`;

export default function App() {
return <CodePreview code={code} dependencies={{ Button }} />;
}
```

### In React 17

```jsx
import Button from '@uiw/react-button';
import CodePreview from '@uiw/react-code-preview';

const code = `import Button from '@uiw/react-button';
import ReactDOM from 'react-dom';
ReactDOM.render(
<div>
<Button type="primary">主要按钮</Button>
<Button type="success">成功按钮</Button>
</div>,
_mount_
);
`;
);`;

export default function App() {
return <CodePreview code={code} dependencies={{ Button }} />;
Expand Down

1 comment on commit 06b310f

@vercel
Copy link

@vercel vercel bot commented on 06b310f Apr 22, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.