react-runner
Run your React code on the air https://nihgwu.github.io/react-runner/
Install
yarn add react-runner
npm install --save react-runner
Props
- children
function({ element, error })
, required render props - code
string
, required the code to be ran - scope
object
globals that could be used in code
- type
string
the type system of the code, code be typescript
or flow
Usage
import Runnder from 'react-runner'
render(
<Runner code={code} scope={scope} type={type}>
{({ element, error }) => (error ? error.toString() : element)}
</Runner>
)
or hooks (require React 16.8 or above)
import { useRunner } from 'react-runner'
const { element, error } = useRunner({ code, scope, type })
License
MIT © Neo