REACT + useState
Starting point for creating JSFiddles with React.
by Lardpower
HTML
<script src="https://unpkg.com/react/umd/react.development.js"></script>
<script src="https://unpkg.com/react-dom/umd/react-dom.development.js"></script>
<div id="root">
<!-- This element's contents will be replaced with your component. -->
</div>
Babel + JSX
const { useState, useEffect } = React;
function Clock(props) {
useEffect(() => {
console.log('effect');
// Update the document title using the browser API
document.documentElement.classList.add('test');
});
return (
<div>
<h1>Hello, world!</h1>
<h2>It is {props.date}.</h2>
</div>
);
}
ReactDOM.render(
<Clock date="Test" />,
document.getElementById('root')
);