From 9bd2b2297921769e6ad97f5c0a5b32538fa09e6d Mon Sep 17 00:00:00 2001 From: Yifei Kong Date: Sat, 2 Sep 2023 12:23:53 +0800 Subject: [PATCH 1/2] Add next.js 13 fix in README --- README.md | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/README.md b/README.md index 5b9668a..a6a4e3d 100644 --- a/README.md +++ b/README.md @@ -57,6 +57,36 @@ const MyComponent = props => { export default MyComponent; ``` +### Next.js 13 + +In Next.js 13, you need to use the new `use client` declarative. + +```jsx +// components/Editor.js +'use client' +import SunEditor from 'suneditor-react' +import 'suneditor/dist/css/suneditor.min.css' + +export default function Editor() { + return +} +``` + +```jsx +// page.jsx +import SunEditor from 'components/Editor' + +const MyComponent = props => { + return ( +
+

My Other Contents

+ +
+ ); +}; +export default MyComponent; +``` + # Props ## About Core From b6fec1375140a4a9611e25a3f0c410cb37b747ff Mon Sep 17 00:00:00 2001 From: Yifei Kong Date: Tue, 5 Sep 2023 10:46:29 +0800 Subject: [PATCH 2/2] Update README.md, passing props in next.js 13 example --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a6a4e3d..d5fd6b9 100644 --- a/README.md +++ b/README.md @@ -67,8 +67,8 @@ In Next.js 13, you need to use the new `use client` declarative. import SunEditor from 'suneditor-react' import 'suneditor/dist/css/suneditor.min.css' -export default function Editor() { - return +export default function Editor(props) { + return } ```