Socket
Socket
Sign inDemoInstall

@ngneat/elf

Package Overview
Dependencies
Maintainers
3
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ngneat/elf

A reactive state management for JS applications


Version published
Weekly downloads
30K
decreased by-0.13%
Maintainers
3
Weekly downloads
 
Created
Source

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 { Store, createState, withProps, select } from '@ngneat/elf';
import { withEntities, selectAll, setEntities } from '@ngneat/elf-entities';

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

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

const { state, config } = createState(
  withProps<TodosProps>({ filter: 'ALL' }),
  withEntities<Todo>()
);

const store = new Store({ name: 'todos', state, config });

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

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

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

Keywords

FAQs

Package last updated on 27 Nov 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc