# react-lensed-state

> Mixin provided ReactLink with lensed attributes

Latest version **0.1.2** (published 2014-12-04) · MIT license · 0 weekly downloads

## Install

```sh
npm install react-lensed-state
pnpm add react-lensed-state
yarn add react-lensed-state
bun add react-lensed-state
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2014-12-04 |
| First published | 2014-09-24 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Node | * |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Andrew Laiff |
| Maintainers | laiff |
| Keywords | mixin, react, react-component, lens, functional, state |

## Links

- npm: https://www.npmjs.com/package/react-lensed-state
- Repository: https://github.com/Laiff/react-lensed-state
- Issues: https://github.com/Laiff/react-lensed-state/issues
- npm.io page: https://npm.io/package/react-lensed-state

## Dependencies (1)

- [data.lens](https://npm.io/package/data.lens.md) 0.0.3

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 0.1.2 (latest) — 2014-12-04
- 0.1.1 — 2014-10-10
- 0.1.0 — 2014-09-24

## 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: "john@example.com"
              },
              notify : {
                  email : true,
                  fb: false
              }
          }
      },
 
      render: function() {
          return (
              <form>
                  <input valueLink={this.linkState('model.user.name')} type="text" name="user-name" />
                  <input valueLink={this.linkState('model.user.email')} type="text" name="user-email" />
                  <input valueLink={this.linkState('model.notify.email')} type="checkbox" name="notify-email" />
                  <input valueLink={this.linkState('model.notify.fb')} type="checkbox" name="notify-fb" />
             </form>
          );
      }
  });
```
## 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/)

---
_Source: https://npm.io/package/react-lensed-state · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
