jreact-lib

React for the 2.0 web

Usage no npm install needed!

<script type="module">
  import jreactLib from 'https://cdn.skypack.dev/jreact-lib';
</script>

README

JReact

JReact is a modern declarative UI framework inspired by React that uses the full power of jQuery under the hood.

import Jreact, {render} from 'jreact';

import App from './components/App';

render(() => <App/>, document.getElementById('app'));

Usage

Set your jsx pragma to Jreact in babelrc

{
  "presets": [
    "@babel/preset-env", 
    ["@babel/preset-react",{
      "pragma": "Jreact",
      "throwIfNamespace": false 
    }
    ]
  ]
}

Then do not use fragments and make sure to escape your html.

You can also use useState and useEffect hooks.

import Jreact, {useState, useEffect} from 'jreact';

const Clock = ({children}) => {
  const [time, setTime] = useState(Date.now())
  useEffect(()=>{
    setInterval(()=>{
      setTime(Date.now())
    },1000)
  },[])
  return (
    <div>
      {new Date(time).getHours()}:
      {new Date(time).getMinutes()}:
      {new Date(time).getSeconds()}
    </div>
  )
}