Skip to content

Instantly share code, notes, and snippets.

@chriscoyier
Created August 31, 2019 17:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chriscoyier/10eecc0a35a36778a8d2458907865025 to your computer and use it in GitHub Desktop.
Save chriscoyier/10eecc0a35a36778a8d2458907865025 to your computer and use it in GitHub Desktop.
const App = () => {
useCodePenEmbed();
return (
<PrefillEmbed
className="codepen"
penTitle="My sweet demo"
embedHeight="400"
themeId="31205"
editable
description="Renders a barebones React component"
tags={['react', 'react-docs-demo']}
htmlClasses={['loading', 'no-js']}
head={
<meta name="viewport" content="width=device-width, initial-scale=1" />
}
scripts={[
'https://unpkg.com/react@16.8.6/umd/react.development.js',
'https://unpkg.com/react-dom@16.8.6/umd/react-dom.development.js',
]}
stylesheets={['https://unpkg.com/normalize.css@8.0.1/normalize.css']}
>
<PrefillLang lang="html">
{stripIndent`
<div id="root"></div>
`}
</PrefillLang>
<PrefillLang lang="scss">
{stripIndent`
$bg: #eee;
body {
background: $bg;
}
`}
</PrefillLang>
<PrefillLang lang="babel">
{stripIndent`
const App = () => <h1>Hello</h1>;
ReactDOM.render(
<App/>,
document.getElementById('root')
);
`}
</PrefillLang>
</PrefillEmbed>
);
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment