The vanilla alternative for writing JSX-based React applications
git clone git://soophie.de/figure
1
# figure2
The vanilla alternative for writing JSX-based React applications4
### Example3
### The vanilla alternative for writing JSX-based React applications4
<br/>6
The figure framework offers a unique approach to writing React applications by leveraging vanilla JavaScript syntax instead of JSX, making it an excellent tool for programmers who prefer to avoid the bloat of the NodeJS/npm ecosystem. With its use of template literals, figure provides a more natural way of writing code, making it ideal for building smaller applications.8
If you're looking for a more efficient way to build React applications, figure might just be the tool you need.9
<br/>10
<br/>12
```javascript7
import figure from '...';13
import figure from 'https://typable.dev/cdn/figure/lib.js';9
// initialize figure15
const { dict } = figure(React.createElement);12
// add your component to the dictionary13
const html = dict({14
el: {15
button: Button,16
},17
});16
const html = dict();18
function App() {19
return html`21
<main>22
<el:button23
type="primary"24
on:click=${() => console.log('It works!')}25
>26
<span>Click me</span>27
</el:button>28
</main>29
`;30
}32
function Button() {33
return html`34
<button35
on:click=${props?.onClick}36
class="btn btn--${props?.type}"37
>38
${props?.children}39
</button>20
<h1>I figured it out!</h1>21
`;22
}43
// render your App component as usual44
const root = document.querySelector('#root');45
ReactDOM.render(React.createElement(App), root);23
```