jarle
<h1 align="center">J.A.R.L.E</h1> <p align="center"> <strong>Just Another React Live Editor</strong> </p>
Last updated 3 years ago by monastic.panic .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install jarle 
SYNC missed versions from official npm registry.

J.A.R.L.E

Just Another React Live Editor

JARLE is a as lightweight but feature-rich React component editor with live preview. JARLE uses sucrase for fast, minimal compilation of JSX and/or Typescript.

Usage

import { Provider, Editor, Error, Preview } from 'jarle';

function LiveEditor() {
  return (
    <Provider code="<strong>Hello World!</strong>">
      <Editor />
      <Error />
      <Preview />
    </Provider>
  );
}

See https://jquense.github.io/jarle/ for docs.

Rendering Code

Jarle removes boilerplate code in your examples, by rendering the last expression in your code block. Define variables, components, whatever, as long as the last line is a JSX expression.

<Provider
  code={`
    function Example({ subject }) {
      return <div>Hello {subject}</div>
    }

    <Example subject="World"/>
  `}
/>

If you do need more control over what get's rendered, or need to render asynchronously, a render function is always in scope:

setTimeout(() => {
  render(<div>I'm late!</div>);
}, 1000);

Jarle also supports rendering your code as a component, helpful for illustrating hooks or render behavior with minimal extra code. When using renderAsComponent the code text is used as the body of React function component, so you can use state and other hooks.

<Provider
  renderAsComponent
  code={`
    const [secondsPast, setSeconds] = useState(0)

    useEffect(() => {
      let interval = setInterval(() => {
        setSeconds(prev => prev + 1)
      }, 1000)

      return () => clearInterval(interval)
    }, [])

    <div>Seconds past: {secondsPast}</div>
  `}
/>

Current Tags

  • 2.1.1                                ...           latest (3 years ago)
  • 2.0.0-beta.1                                ...           next (4 years ago)

16 Versions

  • 2.1.1                                ...           3 years ago
  • 2.1.0                                ...           3 years ago
  • 2.0.0                                ...           4 years ago
  • 2.0.0-beta.1                                ...           4 years ago
  • 2.0.0-beta.0                                ...           4 years ago
  • 1.3.0                                ...           4 years ago
  • 1.2.2                                ...           5 years ago
  • 1.2.1                                ...           5 years ago
  • 1.2.0                                ...           5 years ago
  • 1.1.2                                ...           5 years ago
  • 1.1.1                                ...           5 years ago
  • 1.1.0                                ...           5 years ago
  • 1.0.3                                ...           5 years ago
  • 1.0.2                                ...           5 years ago
  • 1.0.1                                ...           5 years ago
  • 1.0.0                                ...           5 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 0
Last Day 0
Last Week 0
Last Month 1
Dependencies (8)

Copyright 2013 - present © cnpmjs.org | Home |