jreact-lib
v0.0.1
Published
React for the 2.0 web
Downloads
1
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>
)
}