react-habitat
Advanced tools
Comparing version 0.3.0-beta to 0.3.0
{ | ||
"name": "react-habitat", | ||
"version": "0.3.0-beta", | ||
"version": "0.3.0", | ||
"description": "A React DOM Bootstrapper designed to harmonise a hybrid application", | ||
@@ -65,3 +65,3 @@ "main": "./lib/index.js", | ||
"files": [ | ||
"LICENSE.md", | ||
"LICENCE.md", | ||
"index.d.ts", | ||
@@ -68,0 +68,0 @@ "readme.md", |
 | ||
# React Habitat  | ||
# React Habitat  | ||
@@ -24,3 +24,5 @@ ## React Habitat <3 Your CMS | ||
- [Contribute](#want-to-contribute) | ||
- [Change log](#change-log) | ||
- [License information](#license-bsd-3-clause) | ||
- [Examples](https://github.com/DeloitteDigitalAPAC/react-habitat/tree/master/examples) | ||
@@ -314,3 +316,23 @@ | ||
#### 4. Passing values back again | ||
It can be handy to pass values back again, particularly for inputs so the backend frameworks can see any changes or read data. | ||
*Every* React Habitat instance is passed in a prop named `proxy`, this is a reference the original dom element. | ||
Please note only `<inputs />` are left in the DOM by default. To keep a generic element in the DOM, set the `data-habitat-no-replace="true"` attribute. | ||
So for example, we could use `proxy` to update the value of an input like so | ||
```html | ||
<input id="personId" type="hidden" data-component="personLookup" /> | ||
``` | ||
Somewhere inside the component | ||
```javascript | ||
this.props.proxy.value = '1234' | ||
``` | ||
Sometimes you may additionally need to call `this.props.proxy.onchange()` if you have other scripts listening for this event. | ||
## Options & Methods | ||
@@ -395,2 +417,3 @@ | ||
- Updated framework module exports so commonJS no longer needs ugly '.default' [#4](https://github.com/DeloitteDigitalAPAC/react-habitat/issues/4) | ||
- Added examples | ||
@@ -397,0 +420,0 @@ ### [0.2.1] |
 | ||
# React Habitat  | ||
# React Habitat  | ||
@@ -24,3 +24,5 @@ ## React Habitat <3 Your CMS | ||
- [Contribute](#want-to-contribute) | ||
- [Change log](#change-log) | ||
- [License information](#license-bsd-3-clause) | ||
- [Examples](https://github.com/DeloitteDigitalAPAC/react-habitat/tree/master/examples) | ||
@@ -330,7 +332,8 @@ | ||
It can be handy to pass values back again, particularly for inputs so the backend frameworks can see any changes or read data back. | ||
It can be handy to pass values back again, particularly for inputs so the backend frameworks can see any changes or read data. | ||
*Every* React Habitat instance is passed in a prop named `proxy`, this is a reference the original dom element. Please note however only inputs are left in the DOM. | ||
*Every* React Habitat instance is passed in a prop named `proxy`, this is a reference the original dom element. | ||
Please note only `<inputs />` are left in the DOM by default. To keep a generic element in the DOM, set the `data-habitat-no-replace="true"` attribute. | ||
Given this we could use it to update the value of an input like so | ||
So for example, we could use `proxy` to update the value of an input like so | ||
@@ -347,3 +350,3 @@ ```html | ||
Sometimes you may additionally need to call `this.props.proxy.onChange()` if you have other scripts listening for this event. | ||
Sometimes you may additionally need to call `this.props.proxy.onchange()` if you have other scripts listening for this event. | ||
@@ -429,2 +432,3 @@ ## Options and Methods | ||
- Updated framework module exports so commonJS no longer needs ugly '.default' [#4](https://github.com/DeloitteDigitalAPAC/react-habitat/issues/4) | ||
- Added examples | ||
@@ -431,0 +435,0 @@ |
136187
475