A Pen by Oliver Schafeld on CodePen.
Last active
November 5, 2024 12:05
-
-
Save schafeld/3dc65175f40ceb2a59f65ba03e9dea86 to your computer and use it in GitHub Desktop.
React Boilerplate – Quickly test React component code in CodePen – https://codepen.io/schafeld/pen/BaXOLXj?editors=1111
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div id="app"></div> | |
<!-- | |
In JS window use dependencies: | |
https://unpkg.com/react@18/umd/react.development.js | |
https://unpkg.com/react-dom@18/umd/react-dom.development.js | |
Use Babel precompiler. | |
--> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
function App() { | |
const handler = () => console.log('fourth example') | |
return ( | |
<div> | |
<button onClick = {handler} > | |
Click Me! | |
</button> | |
</div> | |
) | |
} | |
export default App | |
*/ | |
const handler = () => console.log('fourth example') | |
class App extends React.Component { | |
render() { | |
return ( | |
<div> | |
<button onClick = {handler} > | |
Click Me! | |
</button> | |
</div> | |
) | |
} | |
} | |
ReactDOM.render( | |
<App />, | |
document.getElementById('app') | |
); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script src="https://unpkg.com/react@18/umd/react.development.js"></script> | |
<script src="https://unpkg.com/react-dom@18/umd/react-dom.development.js"></script> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is a gist for quickly testing a piece of React component code in CodePen.