react-run
Run React code snippets/components from your command-line without config.
Usage
The entry point is a component called App
, example:
Hello World
{count}
// example.js export default function App() { const [count, setCount] = React.useState(0); return ( <div style={{ background: "purple", color: "white", padding: "10px" }}> <h1>Hello World</h1> <p>{count}</p> <button onClick={() => setCount(count + Math.random())}>+ random</button> </div> ); }
You could run this with:
react-run example.js
This will open your default browser with your component loaded.
Check the examples/ to see what is supported.
Installation
With cargo
:
cargo install react-run
Or use a binary from releases.
License
Licensed under the MIT licence.