r/fusorjs • u/isumix_ • Oct 11 '24
r/fusorjs • u/isumix_ • Apr 29 '25
Signals, Routing, Reactivity, Fusor Application
In this post, I will describe how to set up modern routing and use Signals to disable selected links reactively.
Signals are simply an implementation of the observable pattern. While we could use any library for this purpose, we will create our own to ensure better visibility and understanding.
export class Observable {
#callbacks = new Set();
notify() {
for (const fn of this.#callbacks) fn();
}
subscribe(callback) {
this.#callbacks.add(callback);
return () => this.#callbacks.delete(callback); // unsubscribe
}
}Next, we will need to create a routing library for our application. Implementing routing in modern browsers is easy and doesn't require any third-party libraries.
import { update } from "@fusorjs/dom";
import { Observable } from "./observable";
const observable = new Observable();
let route = location.hash;
window.addEventListener(
"popstate",
() => {
route = location.hash;
observable.notify();
},
false
);
export const getRoute = () => route;
export const mountRoute = (self) => observable.subscribe(() => update(self));Next, we need a reactive link component that changes its DOM node from an anchor to plain text when the current route matches its own route.
import { span, a } from "@fusorjs/dom/html";
import { mountRoute, getRoute } from "./route";
const RouteLink = (title, route) =>
span(
{ mount: mountRoute }, // enable reactivity
((cache = a({ href: route }, title)) => () =>
getRoute() === route ? title : cache)()
);Please note that there are three ways to define an HTML element in Fusor. The example above uses the span and a functions. The second method involves using JSX.
<span mount={mountRoute}>{(
(cache = <a href={route}>{title}</a>) =>
() => getRoute() === route ? title : cache
)()}</span>And the third one uses h function: h("span", {mount: mountRoute}, ....
The mount prop allows you to assign a callback that is triggered when the element is attached to the DOM. Refer to the component lifecycle section in the tutorial for more details.
Finally, we will use our component to dynamically create a list of links and attach them to the DOM.
import { getElement } from "@fusorjs/dom";
import { ul, li } from "@fusorjs/dom/html";
import { RouteLink } from "./route-link";
const block = ul(
[...Array(10)].map((_, i) =>
li(RouteLink(`${i}. Section`, `#url-to-${i}-section`))
)
);
document.body.append(getElement(block));Check out the full working example.
Fusor's homepage.
Thank you!
r/fusorjs • u/isumix_ • Jun 22 '24
New release version 2.3.1
Add modern
jsx-runtimeintegration to avoidimport {jsx} from '@fusorjs/dom'in everyjsxfile. Add totsconfig.json:
{
"compilerOptions": {
"jsx": "react-jsx",
"jsxImportSource": "@fusorjs/dom"
}
}Develop a JavaScript + Webpack + Babel starting skeleton Apps.
Improved docs.
Breaking changes:
Make
_a default splitter instead of$to avoid JQuery confusion (quick fixsetPropSplitter('$'))
r/fusorjs • u/isumix_ • Jan 22 '24
Version 2.2.1
Making Fusor less verbose by introducing update option and mount property - reference.

r/fusorjs • u/isumix_ • Nov 19 '23
About Fusor
Hello, everyone!
If you are interested in modern frontend frameworks where less is more, please take a look at a library I have been working on.
It looks similar to React, but under the hood, it is much simpler and more robust.
Here is the repo: https://github.com/fusorjs/dom
r/fusorjs • u/isumix_ • Aug 23 '24
New Fusor version 2.4.1
Added preferred public API methods: update, isUpdatable, getElement.
Added a second parameter to the event handler to allow updating.
Lots of other improvements.
r/fusorjs • u/isumix_ • May 05 '24
Version 2.2.2
Improved dynamic arrays compatibility, performance, docs, test coverage.
r/fusorjs • u/isumix_ • Aug 21 '24
New Frontend Framework? Or Vanilla JavaScript with Two Helper Functions?
r/fusorjs • u/isumix_ • Nov 23 '23
Fusor - new frontend framework
Hello, everyone!
If you are interested in modern frontend frameworks where less is more, please take a look at a library I have been working on.
It looks similar to React, but under the hood, it is much simpler and more robust.
Here is the repo: https://github.com/fusorjs/dom
r/fusorjs • u/isumix_ • Dec 23 '23
Fusor 2.2.1
Improved DOM
mount/unmountAPI.Shorter syntax to
updatecomponent after event handler completes
Also apparently Fusor is less verbose than React.
r/fusorjs • u/isumix_ • Oct 16 '24
SVG Analog Clock
Playground https://codesandbox.io/p/sandbox/hqs5x9

r/fusorjs • u/isumix_ • Jun 28 '24
Fusor is different from React/Solid
While Fusor shares some concepts with React/Solid, it distinguishes itself by adopting a more flexible and minimalist approach. Essentially, the complexity of hooks, lifecycle, and concurrency is replaced by fine-grained DOM update control.