Run React code snippets/components from your command-line without config.
The entry point is a component called App
, example:
// 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.
With cargo
:
cargo install react-run
Or use a binary from releases.
Licensed under the MIT licence.