~repos /atoms-state
git clone https://pyrossh.dev/repos/atoms-state.git
Simple State management for react
0227c409
—
pyros2097 4 years ago
update readme
README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# atoms
|
|
2
2
|
|
|
3
|
-
[](https://www.npmjs.com/package/atoms-state)
|
|
4
4
|
|
|
5
5
|
A simple statemanagement library for react.
|
|
6
6
|
|
|
@@ -11,7 +11,7 @@ A simple statemanagement library for react.
|
|
|
11
11
|
```js
|
|
12
12
|
import React from 'react';
|
|
13
13
|
import ReactDOM from 'react-dom';
|
|
14
|
-
import { atom, useAtom } from '
|
|
14
|
+
import { atom, useAtom } from 'atoms-state';
|
|
15
15
|
|
|
16
16
|
const countAtom = atom(10);
|
|
17
17
|
const sumAtom = atom(get => get(countAtom) + 10);
|
|
@@ -46,7 +46,7 @@ ReactDOM.render(<Counter />, document.getElementById('root'));
|
|
|
46
46
|
```js
|
|
47
47
|
import React, { Suspense } from 'react';
|
|
48
48
|
import ReactDOM from 'react-dom';
|
|
49
|
-
import { asyncAtom, useAsyncAtom } from '
|
|
49
|
+
import { asyncAtom, useAsyncAtom } from 'atoms-state';
|
|
50
50
|
|
|
51
51
|
const todoAtom = asyncAtom(async ({ id }) => {
|
|
52
52
|
const res = await fetch(`https://jsonplaceholder.typicode.com/todos/${id}`);
|