jreact-lib

0.0.1 • Public • Published

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>
  )
}

Dependents (0)

Package Sidebar

Install

npm i jreact-lib

Weekly Downloads

0

Version

0.0.1

License

MIT

Unpacked Size

140 kB

Total Files

18

Last publish

Collaborators

  • saravieira
  • walaura