* . *
  • About
  • Advertise
  • Privacy & Policy
  • Contact
Monday, December 8, 2025
Earth-News
  • Home
  • Business
  • Entertainment
    Country music icon updates fans after heart attack: ‘Got a lot of work I want to do’ – PennLive.com

    Country music icon updates fans after heart attack: ‘Got a lot of work I want to do’ – PennLive.com

    Ex-‘Grey’s Anatomy’ star opens up battle against incurable disease – PennLive.com

    Ex-‘Grey’s Anatomy’ star opens up battle against incurable disease – PennLive.com

    “This acquisition brings together two pioneering entertainment businesses, combining Netflix’s innovation, global reach and best-in-class streaming service with Warner Bros.’ century-long legacy of world-class storytelling.” – facebook.com

    Netflix and Warner Bros. Join Forces to Revolutionize Entertainment with Unmatched Innovation and Legendary Storytelling

    Through the lens: Four decades of arts & entertainment with photojournalist Roger Mastroianni – Fresh Water Cleveland

    Through the lens: Four decades of arts & entertainment with photojournalist Roger Mastroianni – Fresh Water Cleveland

    Discussing Netflix’s deal to buy Warner Bros. – Spectrum News

    Discussing Netflix’s deal to buy Warner Bros. – Spectrum News

    Why Caesars Entertainment (CZR) Stock Is Down Today – Markets Financial Content

    Why Caesars Entertainment (CZR) Stock Took a Hit Today

  • General
  • Health
  • News

    Cracking the Code: Why China’s Economic Challenges Aren’t Shaking Markets, Unlike America’s” – Bloomberg

    Trump’s Narrow Window to Spread the Truth About Harris

    Trump’s Narrow Window to Spread the Truth About Harris

    Israel-Gaza war live updates: Hamas leader Ismail Haniyeh assassinated in Iran, group says

    Israel-Gaza war live updates: Hamas leader Ismail Haniyeh assassinated in Iran, group says

    PAP Boss to Niger Delta Youths, Stay Away from the Protest

    PAP Boss to Niger Delta Youths, Stay Away from the Protest

    Court Restricts Protests In Lagos To Freedom, Peace Park

    Court Restricts Protests In Lagos To Freedom, Peace Park

    Fans React to Jazz Jennings’ Inspiring Weight Loss Journey

    Fans React to Jazz Jennings’ Inspiring Weight Loss Journey

    Trending Tags

    • Trump Inauguration
    • United Stated
    • White House
    • Market Stories
    • Election Results
  • Science
  • Sports
  • Technology
    Nearly 50% crash in Kaynes Technology share price wipes out ₹5000 crore wealth of Mutual funds – livemint.com

    Nearly 50% crash in Kaynes Technology share price wipes out ₹5000 crore wealth of Mutual funds – livemint.com

    Oregon fisheries try old technology to boost salmon returns – Oregon Public Broadcasting – OPB

    Oregon Fisheries Turn to Time-Tested Techniques to Boost Salmon Returns

    An Intrinsic Calculation For Bytes Technology Group plc (LON:BYIT) Suggests It’s 27% Undervalued – Yahoo Finance

    Intrinsic Valuation Reveals Bytes Technology Group Is Undervalued by 27%

    Amundi Acquires 235,432 Shares of Cognizant Technology Solutions Corporation $CTSH – MarketBeat

    Amundi Acquires 235,432 Shares of Cognizant Technology Solutions Corporation $CTSH – MarketBeat

    ComNav unveils innovative products ‘From Earth to Ocean’ – GPS World

    ComNav Launches Revolutionary ‘From Earth to Ocean’ Product Line

    Gorilla Technology (NASDAQ: GRRR) gets 2025 Nobel Sustainability Trust nod for Leadership in Implementation – Stock Titan

    Gorilla Technology (NASDAQ: GRRR) gets 2025 Nobel Sustainability Trust nod for Leadership in Implementation – Stock Titan

    Trending Tags

    • Nintendo Switch
    • CES 2017
    • Playstation 4 Pro
    • Mark Zuckerberg
No Result
View All Result
  • Home
  • Business
  • Entertainment
    Country music icon updates fans after heart attack: ‘Got a lot of work I want to do’ – PennLive.com

    Country music icon updates fans after heart attack: ‘Got a lot of work I want to do’ – PennLive.com

    Ex-‘Grey’s Anatomy’ star opens up battle against incurable disease – PennLive.com

    Ex-‘Grey’s Anatomy’ star opens up battle against incurable disease – PennLive.com

    “This acquisition brings together two pioneering entertainment businesses, combining Netflix’s innovation, global reach and best-in-class streaming service with Warner Bros.’ century-long legacy of world-class storytelling.” – facebook.com

    Netflix and Warner Bros. Join Forces to Revolutionize Entertainment with Unmatched Innovation and Legendary Storytelling

    Through the lens: Four decades of arts & entertainment with photojournalist Roger Mastroianni – Fresh Water Cleveland

    Through the lens: Four decades of arts & entertainment with photojournalist Roger Mastroianni – Fresh Water Cleveland

    Discussing Netflix’s deal to buy Warner Bros. – Spectrum News

    Discussing Netflix’s deal to buy Warner Bros. – Spectrum News

    Why Caesars Entertainment (CZR) Stock Is Down Today – Markets Financial Content

    Why Caesars Entertainment (CZR) Stock Took a Hit Today

  • General
  • Health
  • News

    Cracking the Code: Why China’s Economic Challenges Aren’t Shaking Markets, Unlike America’s” – Bloomberg

    Trump’s Narrow Window to Spread the Truth About Harris

    Trump’s Narrow Window to Spread the Truth About Harris

    Israel-Gaza war live updates: Hamas leader Ismail Haniyeh assassinated in Iran, group says

    Israel-Gaza war live updates: Hamas leader Ismail Haniyeh assassinated in Iran, group says

    PAP Boss to Niger Delta Youths, Stay Away from the Protest

    PAP Boss to Niger Delta Youths, Stay Away from the Protest

    Court Restricts Protests In Lagos To Freedom, Peace Park

    Court Restricts Protests In Lagos To Freedom, Peace Park

    Fans React to Jazz Jennings’ Inspiring Weight Loss Journey

    Fans React to Jazz Jennings’ Inspiring Weight Loss Journey

    Trending Tags

    • Trump Inauguration
    • United Stated
    • White House
    • Market Stories
    • Election Results
  • Science
  • Sports
  • Technology
    Nearly 50% crash in Kaynes Technology share price wipes out ₹5000 crore wealth of Mutual funds – livemint.com

    Nearly 50% crash in Kaynes Technology share price wipes out ₹5000 crore wealth of Mutual funds – livemint.com

    Oregon fisheries try old technology to boost salmon returns – Oregon Public Broadcasting – OPB

    Oregon Fisheries Turn to Time-Tested Techniques to Boost Salmon Returns

    An Intrinsic Calculation For Bytes Technology Group plc (LON:BYIT) Suggests It’s 27% Undervalued – Yahoo Finance

    Intrinsic Valuation Reveals Bytes Technology Group Is Undervalued by 27%

    Amundi Acquires 235,432 Shares of Cognizant Technology Solutions Corporation $CTSH – MarketBeat

    Amundi Acquires 235,432 Shares of Cognizant Technology Solutions Corporation $CTSH – MarketBeat

    ComNav unveils innovative products ‘From Earth to Ocean’ – GPS World

    ComNav Launches Revolutionary ‘From Earth to Ocean’ Product Line

    Gorilla Technology (NASDAQ: GRRR) gets 2025 Nobel Sustainability Trust nod for Leadership in Implementation – Stock Titan

    Gorilla Technology (NASDAQ: GRRR) gets 2025 Nobel Sustainability Trust nod for Leadership in Implementation – Stock Titan

    Trending Tags

    • Nintendo Switch
    • CES 2017
    • Playstation 4 Pro
    • Mark Zuckerberg
No Result
View All Result
Earth-News
No Result
View All Result
Home Technology

Show HN: A JavaScript UI library for imperative JSX

July 6, 2024
in Technology
Show HN: A JavaScript UI library for imperative JSX
Share on FacebookShare on Twitter

A web framework for imperative JSX – a new way to think about UI engineering.

I initially created this for the Matry editor,
but I saw that it could be generally useful, so I’m releasing it under the MIT license.
Right now it’s brand new, under active development, and pretty under-powered.
Do not use it in production until it reaches v1.0.0.

To see examples of it in action, I’ve created a repo with recipes

I love React, but it has issues:

The diffing behavior can be conceptually difficult to understand
It can be awkward to work with inherently imperative constructs such as setTimeout and autofocus

Context, hooks, and signals are all required to pass state around the UI tree
The structure of your application state ends up being shaped by the UI, when it should be the other way around
React takes total control over anything in its tree, meaning most UI packages must have React-specific integrations to work correctly
Getting React to work with SSR has caused lots of headaches
It creates a barrier between the developer and the DOM, leading to a generation of devs missing out on core platform features
There’s a ceiling to how performant a React application can be, and maximizing performance requires deep understanding of React’s rendering model
Because of React’s one-way data flow, there are no built-in features for reading the state of the UI

If we accept the fact that the web is inherently imperative,
then I believe we can resolve most if not all of the above problems.
We don’t need to throw the baby out with the bathwater though, because JSX is fantastic.

Matry exposes a handful of simple, standalone functions that allow you to use JSX to imperatively create and update the DOM.
This is a significant departure from how JSX is traditionally used,
but the benefit of this approach is that your UI remains declarative,
while your business logic remains imperative.
This means no more hooks, no more context, no more prop drilling.

Below are the functions provided by @matry/dom:

Replace – replaces one or more elements’ children

Append – appends new elements

Remove – removes elements

Swap – swaps two elements

Set Content – sets the text content of one or more elements

Set Attributes – sets attributes of one or more elements

Remove Attributes – removes attributes from one or more elements

Add Event Listeners – adds event listeners to one or more elements

Remove Event Listeners – removes event listeners from one or more elements

Below is a simple counter demo.

My Counter App

// set our initial value
let count=0;

// perform our initial render
replace(

The count is {count}
add 1

);

// replace the text content
function add() {
count++;
setContent(The count is {count});
}

In the above example,
we call replace to render our UI into the main element.
Then we use setContent to update the content of the p element.
Notice when updating the DOM, we only need to pass in just enough JSX to identify which elements we want to modify.
This puts you in complete control of your apps performance.

As with all technology, there are advantages and disadvantages of this approach.
In the interest of being transparent, I’ll list the disadvantages first.

Since JSX is acting as a query, the queries have limited expressive power. For instance, in order to match against a node in the DOM, it must be an exact match, i.e. there can be no “contains” queries as it would introduce too many edge cases.
There will be duplication of html content, at least in terms of code. While this can be reduced by various strategies, it’s kind of unavoidable.
You have to really think about the UI, which is something you may not be used to if you’re used to React. I’d argue this is a good thing, but it won’t be everyone’s cup of tea.
It doesn’t define how you procure your state, whereas React tends to be a bit more opinionated. This can lead to more architectural work needed for developers. I’d again argue this is a net good, but you can decide for yourself whether this is something you want.

You have complete control over the rendering process, and can make Matry applications as performant as you want.
Matry doesn’t “own” the UI you pass to JSX, so you can easily use common libraries (e.g. the Google Maps SDK) without worry. Heck, you can even render to the html, head, and body elements!
The functions offered by Matry – write(), append(), setAttributes() and others – are mirror counterparts to native DOM methods, meaning you can think about the platform. There’s no such thing as “thinking in Matry”, it’s just “thinking in the web.”
Unlike React, Matry is truly a “UI library.” It has no side effects that require you to structure your code or your data in any particular way.

First, install the package.
Vite is recommended, mostly because that’s what I’ve used to test it with :p

npm create vite whatever # choose Vanilla, then JavaScript (for now)
cd whatever
npm install @matry/dom

Next, configure Vite so that you can use Matry’s JSX runtime:

// vite.config.js
import { defineConfig } from “vite”;

export default defineConfig({
esbuild: {
jsx: “transform”,
jsxDev: false,
jsxInject: `import { jsx } from ‘@matry/dom’`,
jsxFactory: “jsx.component”,
},
});

Voila! You’re good to go!

Matry should not be considered stable until 1.0.0,
so do not use it in production until then.
There are lots of features yet to be implemented – stay tuned!

Some things I have planned for the library:

TypeScript support

reverse() for reversing lists of elements

paint() for updating the CSSOM

serialize() for rendering JSX to a string (primarily for SSR)

deserialize() for rendering a string (will be used in respones from SSR updates)

read() for loading data from static html into JS memory

>>> Read full article>>>
Copyright for syndicated content belongs to the linked Source : Hacker News – https://www.npmjs.com/package/@matry/dom

Tags: JavaScriptlibrarytechnology
Previous Post

Hadrius (YC W23) Is Hiring Founding Engineers in NYC

Next Post

Properly testing concurrent data structures

WA forest groups sue over bigger riparian buffers – Chinook Observer

Forest Groups Launch Legal Battle to Strengthen Riparian Buffers in Washington

December 8, 2025
The Courts Delivered Important Climate Wins in 2025 – The Equation – Union of Concerned Scientists

Courts Deliver Landmark Wins for Climate Action in 2025

December 8, 2025
Understanding The Science Behind What Makes a Radio Ad Stick – Radio Ink

The Science Behind What Makes a Radio Ad Truly Memorable

December 8, 2025
The men who never remarry aren’t broken. They’ve just stopped playing a game they finally understand. – VegOut

The men who never remarry aren’t broken. They’ve just stopped playing a game they finally understand. – VegOut

December 8, 2025
Nearly 50% crash in Kaynes Technology share price wipes out ₹5000 crore wealth of Mutual funds – livemint.com

Nearly 50% crash in Kaynes Technology share price wipes out ₹5000 crore wealth of Mutual funds – livemint.com

December 8, 2025
Where is the 2025 GameAbove Sports Bowl? – USA Today

Discover the Exciting Location of the 2025 GameAbove Sports Bowl!

December 8, 2025
Odermatt, after downhill win, takes giant slalom – ESPN

Odermatt Stuns Again with Spectacular Giant Slalom Win After Downhill Triumph

December 8, 2025
Trump administration rolls back fuel economy standards, again – TechCrunch

Trump Administration Drastically Rolls Back Fuel Economy Standards Again

December 8, 2025
Country music icon updates fans after heart attack: ‘Got a lot of work I want to do’ – PennLive.com

Country music icon updates fans after heart attack: ‘Got a lot of work I want to do’ – PennLive.com

December 8, 2025
Omaha woman’s health insurance quadruples, expert weighs in – KETV

Omaha Woman’s Health Insurance Costs Soar Fourfold: Expert Explains Why

December 8, 2025

Categories

Archives

December 2025
M T W T F S S
1234567
891011121314
15161718192021
22232425262728
293031  
« Nov    
Earth-News.info

The Earth News is an independent English-language daily published Website from all around the World News

Browse by Category

  • Business (20,132)
  • Ecology (959)
  • Economy (978)
  • Entertainment (21,853)
  • General (18,624)
  • Health (10,017)
  • Lifestyle (989)
  • News (22,149)
  • People (983)
  • Politics (990)
  • Science (16,192)
  • Sports (21,478)
  • Technology (15,959)
  • World (965)

Recent News

WA forest groups sue over bigger riparian buffers – Chinook Observer

Forest Groups Launch Legal Battle to Strengthen Riparian Buffers in Washington

December 8, 2025
The Courts Delivered Important Climate Wins in 2025 – The Equation – Union of Concerned Scientists

Courts Deliver Landmark Wins for Climate Action in 2025

December 8, 2025
  • About
  • Advertise
  • Privacy & Policy
  • Contact

© 2023 earth-news.info

No Result
View All Result

© 2023 earth-news.info

No Result
View All Result

© 2023 earth-news.info

Go to mobile version