Skip to content

Instantly share code, notes, and snippets.

@huberv
Created October 25, 2019 13:49
Show Gist options
  • Save huberv/9ac6264239448e58e0f80690aaf40507 to your computer and use it in GitHub Desktop.
Save huberv/9ac6264239448e58e0f80690aaf40507 to your computer and use it in GitHub Desktop.
Tinkering with create-react-web-component
import React, { useState } from 'react';
import logo from './logo.svg';
import './App.css';
function App() {
const [title, setTitle] = useState("Web Components rock");
return (<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React!
</a>
</header>
<section>
<button onClick={() => {
const newTitle = `${title}!`;
console.log("New title: " + newTitle);
setTitle(newTitle);
}}>toggle title</button>
<web-component componentTitle={title} />
</section>
</div>
);
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment