| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Name | Name | Last commit date | ||
|---|---|---|---|---|
An Engine for DOM Recombobulation.
import { createRender, useState } from 'endr';
const Root = () => {
const [count, setCount] = useState(0);
return (
<div>
<button onclick={() => setCount(count + 1)}>This button</button>{' '}
has been clicked {count} {count === 1 ? 'time' : 'times'}
</div>
);
};
createRender(document.body)(<Root />);Endr takes the best parts of React and ditches the rest to result in a lean and fast virtual DOM rendering library. React is a great tool but has acquired some baggage over its long career that it must maintain for backwards compatibility. Endr loses the baggage and keeps the modern API.
| Package | Size |
|---|---|
| Endr | |
| Preact Preact Hooks |
|
| React React DOM |
Use jsx: automatic and jsxImportSource: 'endr' in your tsconfig.json and JSX transpiler (babel, esbuild, etc) to get correct autocomplete and rendered output. If you forget to do this you'll see errors about React not being found.
<Portal to={parentElement}><div /></Portal>createPortal(<div />, parentElement)const MyComponent () => {
const [error, setError] = useState(undefined);
if (error) return `An error occurred! ${error}`;
return (
<Try catch={setError}>
<AllMyChildren />
</Try>
);
};import { createRender } from 'endr';
const render = createRender(document.body);
render(<MyDisappearingApp />);
setTimeout(() => render(), 5000);| Back | FazBrowse Home | New Git URL |