Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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')
- Host: GitHub
- URL: https://github.com/laiff/react-lensed-state
- Owner: Laiff
- License: mit
- Created: 2014-09-24T06:17:22.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2014-12-04T06:13:09.000Z (almost 10 years ago)
- Last Synced: 2024-08-10T10:56:18.897Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 130 KB
- Stars: 9
- Watchers: 2
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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 (
);
}
});
```
## InstallingThe 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/)