Skip to content
main
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
lib
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

redux.rb [version] [ci]

A Redux implementation in Ruby.

Setup

Add to your Gemfile:

gem 'redux'

Usage

reducer = ->(state = 0, action){
  case action['type']
  when 'INCREMENT'
    state + 1
  when 'DECREMENT'
    state - 1
  else
    state
  end
}

store = Redux::Store.new(0, &reducer)
store.dispatch "type" => "INCREMENT"
store.state # => 1

MIT License

Copyright (C) 2016 Jan Lelis https://janlelis.com. Released under the MIT license.

About

A tiny Ruby redux

Topics

Resources

License

Packages

No packages published

Languages