cami.js
Immer
cami.js | Immer | |
---|---|---|
8 | 142 | |
366 | 27,034 | |
- | 0.8% | |
9.5 | 7.1 | |
11 days ago | 15 days ago | |
HTML | JavaScript | |
MIT License | MIT License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
cami.js
-
HTML Web Components
Preact requires a build step otherwise you don't get JSX and you have to build applications a la mithril.js mode:
> const app = h('h1', null, 'Hello World!');
With Web Components no build step is required and you're still able to build JSX'ish code. See the code below this section: https://github.com/kennyfrc/cami.js#key-concepts--api
- Cami.js - A No Build, Web Component Based UI Framework
-
Show HN: Cami.js – A No Build, Web Component Based Reactive Framework
Yes, the lib's great!
Unfortunately I haven't thought much yet about interoperability with other web components libraries like lit. I imagined folks would choose just one web component library over the other.
That said, you can initialize reactive properties(1), but property bindings won't work if there's a parent LitElement (as my reactive properties need to be called with either a .value method or an .update method for getting and setting respectively).
As of the moment, what's possible is interop with other cami elements using a store, and in a future version, i'm considering a richer event system for external javascript code to listen to.
---
(1) Initializing is possible with observerableAttr: https://github.com/kennyfrc/cami.js/blob/master/examples/008...
-
Leaders Are Tool Builders: Why I Wrote My Own JavaScript UI Framework
The author is getting a bit of heat, and I think rightfully so. Here is the "tool" he's all bragging about: https://github.com/kennyfrc/cami.js/blob/master/src/cami.js
The whole thing is 250 Loc half of which is comments. And not to discount on that (Redux itself is not that big, though the ecosystem is). But this tool/project could be just a few blog posts where the author explains the patterns/libraries he is using.
It also doesn't help that his blog post/tool has the highest concentration of buzzword language you can expect. Please don't do that.
Immer
-
Comparing React state tools: Mutative vs. Immer vs. reducers
Immer is a lightweight package that simplifies working with immutable states. Immutable data structures ensure efficient data change detection, making it easier to track modifications. Additionally, they enable cost-effective cloning by sharing unchanged parts of a data tree in memory.
-
Immer VS mutative - a user suggested alternative
2 projects | 25 Jan 2024
-
Show HN: Cami.js – A No Build, Web Component Based Reactive Framework
```
It looks like it’s mutating, but both the reducers and update() uses immer* under the hood, so we still respect immutability under the hood.
Cami supports redux devtools so you can use that for time-travel debugging too!
—-
* https://github.com/immerjs/immer
- Why do we need modules at all?
-
Making Sense of React Server Components
I heard that immutability libraries like immer.js [0] help with this. Anyone go this way and had good success? Is this 'the way'?
[0]: https://immerjs.github.io/immer/
-
How We Fixed Performance With JS Object Variable Mutation
So, that's what we built, and we built it in the most obvious way — using JavaScript Proxy objects to track mutations and reflect those changes across Appsmith’s framework. Initially things looked good — it worked, aside from a few hacks to make some data types work with map and set, and we were following the example of other projects that had similar requirements. If it was good enough for them, it should be good enough for us, right?
-
The sword refers to immer, the faster and stronger immutable data js tool limu stable version released!
But is immer really the ultimate answer? The performance problem of immer is more prominent in large arrays and deep-level object scenarios. See this issue description, many authors in the community began to try to make breakthroughs, and noticed that structura and mutative, I found that it is indeed many times faster than immer as they said, but it still fails to solve the problem of both fast speed and good development experience. I will analyze the two issues in detail below.
-
Ramda: A practical functional library for JavaScript programmers
I like immer for this kind of thing: https://github.com/immerjs/immer
It gives you immutable updates without getting bogged down in FP abstractions.
-
Why my variable is being mutated if I make any changes to my data ?
I've always been a huge fan of immer for these case. For your code, it would simply turn into setGridData((prev) => produce(prev, draft => applyChanges(changes, draft)) but I recommend you go over their documentation to fully understand how it works
-
Is there a better way to do read-only types
If you're trying to make things actually immutable, Object.freeze and deep copies can clutter things up pretty good, have you considered using something like immer? (https://immerjs.github.io/immer/)
What are some alternatives?
select2 - Select2 is a jQuery based replacement for select boxes. It supports searching, remote data sets, and infinite scrolling of results.
immutability-helper - mutate a copy of data without changing the original source
ElementsJS - A lightweight DOM Manipulation library for VanillaJS
immutable-js - Immutable persistent data collections for Javascript which increase efficiency and simplicity.
formio - A Form and Data Management Platform for Progressive Web Applications.
redux-toolkit - The official, opinionated, batteries-included toolset for efficient Redux development
mini-van - Mini-Van: A minimalist template engine for DOM generation and manipulation, working for both client-side and server-side rendering (SSR)
Recoil - Recoil is an experimental state management library for React apps. It provides several capabilities that are difficult to achieve with React alone, while being compatible with the newest features of React.
marimo - A reactive notebook for Python — run reproducible experiments, execute as a script, deploy as an app, and version with git.
react-query - 🤖 Powerful asynchronous state management, server-state utilities and data fetching for TS/JS, React, Solid, Svelte and Vue. [Moved to: https://github.com/TanStack/query]
webcomponents-blog-examples
valtio - 💊 Valtio makes proxy-state simple for React and Vanilla