Skip to content

Balastrong/angular-redux

Repository files navigation

Angular Redux

Official Angular bindings for Redux. Performant and flexible.

GitHub Workflow Status npm version npm downloads

Warning

This package is in alpha and is rapidly developing.

Installation

Angular Redux requires Angular 17.3 or later.

To use React Redux with your Angular app, install it as a dependency:

# If you use npm:
npm install @reduxjs/angular-redux

# Or if you use Yarn:
yarn add @reduxjs/angular-redux

You'll also need to install Redux and set up a Redux store in your app.

This assumes that you’re using npm package manager with a module bundler like Webpack or Browserify to consume CommonJS modules.

Usage

The following Angular component works as-expected:

import { Component } from '@angular/core'
import { injectSelector, injectDispatch } from "@reduxjs/angular-redux";
import { decrement, increment } from './store/counter-slice'
import { RootState } from './store'

@Component({
  selector: 'app-root',
  standalone: true,
  template: `
      <button (click)="dispatch(increment())">
        Increment
      </button>
      <span>{{ count() }}</span>
      <button (click)="dispatch(decrement())">
        Decrement
      </button>
  `
})
export class AppComponent {
  count = injectSelector((state: RootState) => state.counter.value)
  dispatch = injectDispatch()
  increment = increment
  decrement = decrement
}

About

Official Angular bindings for Redux

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

No packages published

Languages

  • TypeScript 82.5%
  • JavaScript 11.8%
  • CSS 5.5%
  • HTML 0.2%