Skip to content

Commit e02d234

Browse files
docs(README.md): dedup example code
1 parent ac1bce3 commit e02d234

File tree

1 file changed

+4
-18
lines changed

1 file changed

+4
-18
lines changed

README.md

Lines changed: 4 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ const exampleCode = `
9696
return () => <App />;
9797
`;
9898

99-
render(
99+
const Content = (
100100
<Highlight {...defaultProps} code={exampleCode} language="jsx">
101101
{({ className, style, tokens, getLineProps, getTokenProps }) => (
102102
<pre className={className} style={style}>
@@ -109,27 +109,13 @@ render(
109109
))}
110110
</pre>
111111
)}
112-
</Highlight>,
113-
document.getElementById('root')
112+
</Highlight>
114113
);
114+
render(Content, document.getElementById('root'));
115115

116116
// If you are using React 18
117117
// const root = createRoot(document.getElementById('root'));
118-
// root.render(
119-
// <Highlight {...defaultProps} code={exampleCode} language="jsx">
120-
// {({ className, style, tokens, getLineProps, getTokenProps }) => (
121-
// <pre className={className} style={style}>
122-
// {tokens.map((line, i) => (
123-
// <div {...getLineProps({ line, key: i })}>
124-
// {line.map((token, key) => (
125-
// <span {...getTokenProps({ token, key })} />
126-
// ))}
127-
// </div>
128-
// ))}
129-
// </pre>
130-
// )}
131-
// </Highlight>
132-
// )
118+
// root.render(Content);
133119
```
134120

135121
`<Highlight />` is the only component exposed by this package, as inspired by

0 commit comments

Comments
 (0)