Comparing version 4.0.0 to 4.0.1
{ | ||
"name": "alt-form", | ||
"version": "4.0.0", | ||
"version": "4.0.1", | ||
"description": "Manage your forms with alt", | ||
"main": "lib/altForm.js", | ||
"dependencies": { | ||
"flux-form": "4.1.0" | ||
"flux-form": "4.1.1" | ||
}, | ||
@@ -13,3 +13,4 @@ "devDependencies": { | ||
"scripts": { | ||
"build": "babel src --out-dir lib" | ||
"build": "babel src --out-dir lib", | ||
"prebublish": "npm run build" | ||
}, | ||
@@ -16,0 +17,0 @@ "repository": { |
@@ -6,3 +6,25 @@ # alt-form | ||
```js | ||
const form = altForm('Company', alt, { | ||
fields: [ 'name' ], | ||
}) | ||
class EditName extends React.Component { | ||
constructor(props) { | ||
super(props) | ||
this.state = form.getProps({ | ||
name: props.initialName | ||
}) | ||
} | ||
// Please don't connect stores yourself, use something like | ||
// https://github.com/altjs/react which connects your stores automatically | ||
componentDidMount() { | ||
this.unlisten = form.store.listen(state => this.setState(state)) | ||
} | ||
componentWillUnmount() { | ||
this.unlisten() | ||
} | ||
render() { | ||
@@ -15,6 +37,6 @@ return ( | ||
placeholder="Name" | ||
{...this.props.form.props.name} | ||
{...this.state.props.name} | ||
/> | ||
<input type="button" onClick={this.props.form.save} /> | ||
<input type="button" onClick={this.state.save} /> | ||
</div> | ||
@@ -25,22 +47,6 @@ ) | ||
export default connectToStores(EditName, () => { | ||
const form = altForm('Company', alt, { | ||
fields: [ 'name' ], | ||
}) | ||
export default EditName | ||
``` | ||
return { | ||
listenTo() { | ||
return [form.store] | ||
}, | ||
getProps(props) { | ||
return { | ||
form: form.getProps({ | ||
name: props.initialName | ||
}) | ||
} | ||
}, | ||
} | ||
}) | ||
```js | ||
<EditName initialName="Jane" /> | ||
@@ -47,0 +53,0 @@ ``` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4445
54
+ Addedflux-form@4.1.1(transitive)
- Removedflux-form@4.1.0(transitive)
Updatedflux-form@4.1.1