@tentjs/tent
v0.0.33-4
Published
A jsx-free, super-lightweight and zero-dependency library to add interactivity to the web - without all the nonsense.
Downloads
42
Readme
⛺ Tent
A jsx-free, super-lightweight and zero-dependency library to add reactivity to the web — without all the nonsense.
[!IMPORTANT]
Tent is currently in early development. It can be used in production, but there might be breaking changes in future versions. If you're interested in contributing, please submit a PR or report an issue. Keep track of the changes in the CHANGELOG.
⚙️ Installation
npm install @tentjs/tent
⚡ Quickstart
Getting started is very easy. Here's a simple example component that increments a number when the button is clicked. This example demonstrates creating a stateful component, updating the state, and mounting it to the DOM.
import { type Component, mount, tags } from '@tentjs/tent';
// Tags are used to create elements - like `div`, `button`, `span`, etc.
const { button } = tags;
type State = { count: number };
const Counter: Component<State> = {
// Initial state
state: { count: 0 },
// Define the view
view({ state }) {
return button(
`You clicked ${state.count} times`,
// Add attributes to the button
{ onclick: () => state.count++ },
);
},
};
// Append the component to the body
mount(document.body, Counter);
💡 Examples
You can find examples for building a simple counter, todo list, a form and more in the examples repository.
👍🏻 Contribute
If you want to support the active development of Tent, there are a few ways you can help:
- Give a ⭐ — bring attention to the project.
- Tweet about it — share your excitement.
- Get involved — join the discussions.
- Contribute — submit a pull request.
- Buy me a ☕ — thank you for your support!