beekai-oss / little-state-machine

📠 React custom hook for persist state management
https://lrz5wloklm.csb.app/
MIT License
1.48k stars 53 forks source link

How to use LSM in Next.js 14 (app router) #151

Open spacecat opened 3 months ago

spacecat commented 3 months ago

Hi,

I searched the issues here and someone mentioned to use ssr: false using a dynamic import but I can't get it to work.

const createStore = dynamic(
  () => import("little-state-machine").then((mod) => mod.createStore),
  { ssr: false },
);

What is the correct way to import LSM in a Next.js 14 (app router) app?