docusaurus-theme-ts-playground
v0.1.1
Published
Docusaurus ts playground button component.
Downloads
16
Readme
Docusaurus TS Playground
You can create link to "TS Playground" with a code block ts-button
meta string.
Install
npm i docusaurus-theme-ts-playground # or yarn add docusaurus-theme-ts-playground
Modify your docusaurus.config.js
module.exports = {
...
+ themes: ['ts-playground'],
presets: ['@docusaurus/preset-classic']
...
}
Example:
```jsx ts-button
function Clock(props) {
const [date, setDate] = useState(new Date());
useEffect(() => {
var timerID = setInterval(() => tick(), 1000);
return function cleanup() {
clearInterval(timerID);
};
});
function tick() {
setDate(new Date());
}
return (
<div>
<h2>It is {date.toLocaleTimeString()}.</h2>
</div>
);
}
```