function App() {
const [store, setStore] = createStore({
userCount: 3,
users: [
{
id: 0,
username: "felix909",
location: "England ",
loggedIn: true,
},
{
id: 1,
username: "tracy634",
location: "Canada",
loggedIn: true,
},
{
id: 2,
username: "johny123",
location: "India",
loggedIn: true,
},
],
});
const logOutUser = () => {
setStore([0, 2], (user) => user.loggedIn, false);
};
return (
...
<button onClick={logOutUser}>Log out Tracy & Johnny</button>
...
)
}
function App() {
const [store, setStore] = createStore({
userCount: 3,
users: [
{
id: 0,
username: "felix909",
location: "England ",
loggedIn: true,
},
{
id: 1,
username: "tracy634",
location: "Canada",
loggedIn: true,
},
{
id: 2,
username: "johny123",
location: "India",
loggedIn: true,
},
],
});
const logOutUser = () => {
setStore([0, 2], (user) => user.loggedIn, false);
};
return (
...
<button onClick={logOutUser}>Log out Tracy & Johnny</button>
...
)
}