Skip to content

Commit 035e354

Browse files
committed
doc: Update Document.
1 parent aaf5b09 commit 035e354

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,44 @@ const Dome = () => (
118118
ReactDOM.render(<Dome />, document.getElementById('app'));
119119
```
120120

121+
## Support Nextjs
122+
123+
Use examples in [nextjs](https://nextjs.org/). [#52](https://github.com/uiwjs/react-md-editor/issues/52#issuecomment-848969341) [#224](https://github.com/uiwjs/react-md-editor/issues/224#issuecomment-901112079)
124+
125+
[![Open in CodeSandbox](https://img.shields.io/badge/Open%20in-CodeSandbox-blue?logo=codesandbox)](https://codesandbox.io/embed/nextjs-example-react-markdown-editor-72s9d?fontsize=14&hidenavigation=1&theme=dark)
126+
127+
```bash
128+
npm install next-remove-imports
129+
npm install @uiw/react-markdown-editor
130+
```
131+
132+
```js
133+
// next.config.js
134+
const removeImports = require('next-remove-imports')();
135+
module.exports = removeImports({});
136+
```
137+
138+
```jsx
139+
import dynamic from 'next/dynamic';
140+
import '@uiw/react-markdown-editor/markdown-editor.css';
141+
import '@uiw/react-markdown-preview/markdown.css';
142+
143+
const MarkdownEditor = dynamic(
144+
() => import("@uiw/react-markdown-editor").then((mod) => mod.default),
145+
{ ssr: false }
146+
);
147+
148+
function HomePage() {
149+
return (
150+
<div>
151+
<MarkdownEditor value="Hello Markdown!" />
152+
</div>
153+
);
154+
}
155+
156+
export default HomePage;
157+
```
158+
121159
## Props
122160

123161
- `value (string)` - the raw markdown that will be converted to html (**required**)

0 commit comments

Comments
 (0)