react-view
react-view copied to clipboard
Make `props.value` accept JSX
I've recently been writing a lot of "stringified JSX", which can become quite hard to maintain.
Would it be possible to provide props.value or initialCode as JSX?
For example:
const config = {
initialCode: () => {
const [flag, setFlag] = useState(false);
const handleClick = () => setFlag(true);
return (
<div>
<Button onClick={handleClick}>Set flag</Button>
</div>
);
},
scope: { Button },
};
<hr />
Possibly related or duplicate of #10?
The approach in #10 could work (might be more complicated due to JSX).