Skip to content

Commit

Permalink
Update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
wobsoriano authored Sep 27, 2024
1 parent c392e49 commit 23aeda8
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,21 +26,21 @@ npm install nanostores @nanostores/solid

```ts
// store.ts
import { action, atom } from 'nanostores';
import { atom } from 'nanostores';

export const counter = atom(0);
export const $counter = atom(0);

export const increase = action(counter, 'increase', (store) => {
counter.set(counter.get() + 1);
});
export const increase = () => {
$counter.set($counter.get() + 1);
}
```

```tsx
import { useStore } from '@nanostores/solid';
import { counter, increase } from './store';
import { $counter, increase } from './store';

function Counter() {
const count = useStore(counter);
const count = useStore($counter);
return <h1>{count()} around here ...</h1>;
}

Expand Down

0 comments on commit 23aeda8

Please sign in to comment.