0
Fork 0
mirror of https://github.com/withastro/astro.git synced 2025-01-27 22:19:04 -05:00
astro/examples/with-nanostores/src/components/AdminsReact.jsx

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

31 lines
665 B
React
Raw Normal View History

import * as React from 'react';
import { useStore } from '@nanostores/react';
2021-06-24 22:40:29 +00:00
import { admins } from '../store/admins.js';
import { counter, increaseCounter, decreaseCounter } from '../store/counter.js';
const AdminsReact = () => {
const list = useStore(admins);
const count = useStore(counter);
2021-12-13 18:37:58 +00:00
return (
<>
<h1>React</h1>
<ul>
{list.map((admin) => (
<li key={admin.id}>{JSON.stringify(admin, null, 2)}</li>
2021-06-24 22:40:29 +00:00
))}
</ul>
<div>
<h3>Counter</h3>
<p>{count.value}</p>
<button onClick={decreaseCounter}>-1</button>
<button onClick={increaseCounter}>+1</button>
</div>
<br />
</>
);
2021-06-24 22:40:29 +00:00
};
2021-06-24 22:40:29 +00:00
export default AdminsReact;