@@ -35,7 +35,7 @@ const ExampleComponent = () => {
3535
3636 useEffect (() => {
3737 setMarkdownSource (' # markdown header' );
38- }, [])
38+ }, []);
3939
4040 return reactContent ;
4141};
@@ -66,6 +66,23 @@ const ExampleComponent = () => {
6666export default ExampleComponent ;
6767```
6868
69+ ### Server side rendering
70+
71+ ``` tsx
72+ import React from ' react' ;
73+ import { useRemarkSync } from ' react-remark' ;
74+
75+ const ExampleComponent = () => {
76+ const reactContent = useRemarkSync (' # markdown header' );
77+
78+ return reactContent ;
79+ };
80+
81+ export default ExampleComponent ;
82+ ```
83+
84+ :notebook : Note that some remark plugins are async, these plugins will error if used with ` useRemarkSync ` .
85+
6986[ More examples of usage as hook in storybook.] ( https://remarkjs.github.io/react-remark/?path=/story/remark-hook )
7087
7188### As a component
@@ -160,7 +177,7 @@ const [reactContent, setMarkdownSource] = useRemark({
160177 rehypePlugins: [rehypeSlug , rehypeAutoLinkHeadings ],
161178 rehypeReactOptions: {
162179 components: {
163- p : props => <p className = " custom-paragraph" { ... props } />,
180+ p : ( props ) => <p className = " custom-paragraph" { ... props } />,
164181 },
165182 },
166183});
@@ -183,7 +200,7 @@ import rehypeAutoLinkHeadings from 'rehype-autolink-headings';
183200 rehypePlugins = { [rehypeSlug , rehypeAutoLinkHeadings ]}
184201 rehypeReactOptions = { {
185202 components: {
186- p : props => <p className = " custom-paragraph" { ... props } />,
203+ p : ( props ) => <p className = " custom-paragraph" { ... props } />,
187204 },
188205 }}
189206>
0 commit comments