merisbahti / klyva Goto Github PK
View Code? Open in Web Editor NEWA state management library that follows the React component model
License: MIT License
A state management library that follows the React component model
License: MIT License
Create docs/*.md detailing:
.server
-components for data fetching!)focusAtom
and useAtomSlice
, with prop drilling, enable you to build more testable apps.In an older version of https://github.com/dai-shi/will-this-react-global-state-work-in-concurrent-rendering we had klyva included. At that time, klyva was passing all tests except this one:
check with useTransition
β check 7: proper branching with transition (6127 ms)
What is this test 7 checking? Is this something that is hard to fix in klyva? If it needs a de-optimisation, could it be as an optional extra or a plugin or monkeypatch under a contrib/ folder, so that klyva could be the first to pass all the known tests for concurrent mode? π
βοΈ asking for a friend :) cc @kkogovsek
Make a 5 minute tutorial with associated starting code sandbox.
High level script:
What is klyva (simplified state management, basically just useState)
Start by building TodoItem component
Make that TodoItem take an atom as a prop (global state that feels local)
Expand and build TodoList
Some things that came up when trying out Klyva:
make optics part of the Klyva tagline. it's the thing that really sets this lib apart from all others. good to communicate that from the start.
considering optics is such a big thing in this library, I think it would be great to give some practical examples.
start examples with import statement, e.g.
import {atom} from 'klyva'
const countAtom = atom(5)
useAtom
or useSelector
hook in that component.the source code in "react-utils.ts" is importing and using both react
and react-dom
packages directly, but these packages are not included in the dependency
field in your package.json
(they are however located in devDependencies
).
you could add them under peerDependencies
field as ^16.8.3
to allow the end user to supply their own react/react-dom version from their project
I would like to try doing something like this,
const sumAtom = atom(async get => {
get(atomOne)
return await fetch("/api");
})
To capture the interest of developers, it would be beneficial if:
import
line, and "one line" changes in the actual code to use this library instead of whatever was in use before.(We discussed this on Discord, and I plan to update this more a bit later)
As discussed elsewhere, it would be awesome to mention useSelector specifically to help users. cc @kkogovsek
Similar to jotai, we should have support for devtools:
https://github.com/pmndrs/jotai/blob/master/src/devtools/useAtomDevtools.ts
https://github.com/pmndrs/jotai/blob/master/docs/debugging.md
If we assume jest, and optionally some jest-extension, what developer experience should there be for testing an app built with klyva?
Maybe something like klyva.resetAll() to move klyva state to initial? How would this be done with a redux-based app?
Thanks! Came here from pmndrs/jotai#13 and pmndrs/jotai#44
A declarative, efficient, and flexible JavaScript library for building user interfaces.
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. πππ
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google β€οΈ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.