SolidJSS
SolidJS11mo ago
32 replies
Carl (klequis)

Store update produces error "current is undefined"

I'm creating the example in the doc and getting the error

Uncaught TypeError: current is undefined
    updatePath dev.js:217
    ...
    setStore dev.js:247
    ...


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>
    ...
  )

}
Was this page helpful?