Discussion

Show HN: A new kind of React store

Hey HN!

I am a developer on a break from employment. I want to use this time to recharge and work on projects that I always wanted to do but lacked energy after regular job.

One of the problems that we never solved properly is web application state management. What I want is a library that:

- encourages separating application state and logic from React components

- makes dealing async state dead simple (like react query)

- makes creating derived (computed) state dead simple (like computed properties in vue) including deriving async state

- allows to create reusable logic that can be imported as a library (like react hooks)

- allows to easily compose a few simple pieces of application state into a bigger logical unit that can be developed, consumed and tested separately

I've played with various ideas for the last few years, sometimes going crazy that I couldn't find, or create something meeting all these criteria. Finally, a few months ago something clicked and that's how active-store was born.

I am terrible at writing documentation, but I am good at writing code. Take a look at the store for a simple HN client: https://codesandbox.io/p/sandbox/headless-resonance-dfzgzw. It's just ~100 lines of code with comments. The code handles the most important aspects of loading data from HN. I think this is a good example, because the HN API is quite difficult to work with.

There's more documentation at https://github.com/ziolko/active-store and another project that I used as a playground at https://github.com/roombelt/timeline.

Despite the terrible documentation I encourage you to give it a try. I will be happy to answer your comments here.

3 points ziolko 2 years ago 1 comments

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton