Git Product home page Git Product logo

elf's Introduction

Elf

A Reactive Store with Magical Powers

Elf is a reactive immutable state management solution built on top of RxJS. It uses custom RxJS operators to query the state and pure functions to update it.

Elf encourages simplicity. It saves you the hassle of creating boilerplate code and offers powerful tools with a moderate learning curve, suitable for experienced and inexperienced developers alike.

✅  Modular by design
✅  Tree Shakeable & Fully Typed
✅  CLI
✅  First Class Entities Support
✅  Requests Status & Cache
✅  Persist State
✅  State History
✅  Pagination
✅  Devtools


@ngneat/elf commitizen PRs coc-badge semantic-release styled with prettier

🤓 Learn about it on the docs site

👩‍🎓 Check out the React Todos example

😋 Check out the Angular Todos example or Books example


import { createStore, withProps, select, setProp } from '@ngneat/elf';
import { withEntities, selectAllEntities, setEntities } from '@ngneat/elf-entities';

interface TodosProps {
  filter: 'ALL' | 'ACTIVE' | 'COMPLETED';
}

interface Todo {
  id: string;
  title: string;
  status: string;
}

const store = createStore(
  { name: 'todos' },
  withProps<TodosProps>({ filter: 'ALL' }),
  withEntities<Todo>()
);

export const filter$ = store.pipe(select(({ filter }) => filter));
export const todos$ = store.pipe(selectAllEntities());

export function setTodos(todos: Todo[]) {
  store.update(setEntities(todos));
}

export function updateFilter(filter: TodosProps['filter']) {
  store.update(setProp('filter', filter));
}

🗒️ Review the Change Logs

elf's People

Contributors

5im0n avatar davidsidlinger avatar dmitryefimenko avatar ericpoul avatar gili-lumigo avatar hakimio avatar hrvbernardic avatar ido-golan avatar jorisdebonnet avatar kiesman99 avatar leon avatar mdudek avatar netanel-utila avatar netanelbasal avatar pascalbayer avatar pascalmh avatar pavankjadda avatar ricardojbarrios avatar ritox842 avatar robingenz avatar ron-myers avatar samelie avatar shaharkazaz avatar shairez avatar sonystone avatar stlmpp avatar theblushingcrow avatar thomas-w-grant avatar yackinn avatar zubko avatar

Stargazers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.