News for hackers. Stuff that matters.
Re:Show HN: The simplest React state manager now at stable r... by mewpmewp2 on Tuesday April 20, 2021 @08:52AM (#26873891)
Would it work with server side rendering?

Usually there would be a problem importing/defining things from static files like that as this would be shared within the server between instances of renderings.

Re:Show HN: The simplest React state manager now at stable r... by aenero on Wednesday April 21, 2021 @12:47AM (#26885518)
SimpleR State acts as a "module-level store", one of the reasons why it's so simple. When you start doing SSR, though, as with anything else in React global state management, you would sacrifice some of that simplicity.

So to answer the question, yes SimpleR State works with SSR, but you need to take an extra step. You would need to somehow "scope" your global state inside the React component tree. The most common solution is using a Context to store your server-side entities, so that they are not "shared" among SSR requests.

SimpleR State proclaims itself as "unopinionated", so the preferred SSR solution is a decision that the developer has to make. It would be worth adding some options in the documentation, though. So thanks for bringing this up. I also received a few requests on such documentation in the previous Request For Comments during the beta run. A doc page on SSR is underway.

Re:Show HN: The simplest React state manager now at stable r... by munawwar on Tuesday April 20, 2021 @05:34PM (#26882062)
The simplicity goes away when supporting SSR. You have to depend on multiple stores (one per request) being injected "from the top" (e.g via Context Provider).

This is my take on the problem -> https://github.com/Munawwar/react-global-states/tree/ssr