Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/laiff/react-lensed-state

React mixin, for this.linkState ('model.user.name')
https://github.com/laiff/react-lensed-state

Last synced: 26 days ago
JSON representation

React mixin, for this.linkState ('model.user.name')

Awesome Lists containing this project

README

        

[![Build Status](https://secure.travis-ci.org/Laiff/react-lensed-state.svg?branch=master)](https://travis-ci.org/Laiff/react-lensed-state)
[![NPM version](https://badge.fury.io/js/react-lensed-state.svg)](http://badge.fury.io/js/react-lensed-state)
[![Dependencies Status](https://david-dm.org/Laiff/react-lensed-state.svg?style=flat-square)](https://david-dm.org/Laiff/react-lensed-state)
[![experimental](http://hughsk.github.io/stability-badges/dist/experimental.svg)](http://github.com/hughsk/stability-badges)

react-lensed-state
==================

Adds react opportunity to work with the state in a hierarchical notation, for example this.linkState ('model.user.name') will point to the part of the object state. Work of lens are immutable, that is, after changing the value will create a new state object.

## Example

``` js
var LensedExample = React.createClass({

mixins : [LensedStateMixin],

getInitialState : {
model : {
user : {
name: "John",
email: "[email protected]"
},
notify : {
email : true,
fb: false
}
}
},

render: function() {
return (






);
}
});
```
## Installing

The easiest way is to grab it from NPM. If you're running in a Browser
environment, you can use [Browserify][]

$ npm install react-lensed-state

[![NPM](https://nodei.co/npm/react-lensed-state.png?downloads=true&downloadRank=true&stars=true)](https://nodei.co/npm/react-lensed-state/)