// for example, MyFunComponent.tsx
import { useState } from 'react';
export const MyFunComponent = (props: { text: string }) => {
const [count, setCount] = useState(0);
return (
<div>
<h3>{props.text.toUpperCase()}</h3>
<p>{count}</p>
<button onClick={() => setCount(count + 1)}>Click me</button>
</div>
);
};
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter