A online playground for react, inspired by vue/repl and unocss/playground.
Thanks to the open source of vue/repl and its maintainers, this project is built to provide a similar experience for react.
React REPL as a React component.
// vite.config.ts
import { defineConfig } from 'vite'
export default defineConfig({
optimizeDeps: {
exclude: ['@zhangmo8/repl-react'],
},
// ...
})import { Repl, useReplStore } from '@zhangmo8/repl-react'
const Demo = () => {
const { state, setState } = useReplStore()
return (
<div>
<Repl />
<p>Code: {state.code}</p>
</div>
)
}