Comparing version 0.2.14 to 0.2.15
@@ -7,3 +7,3 @@ { | ||
"license": "MIT", | ||
"version": "0.2.14", | ||
"version": "0.2.15", | ||
"source": "src/main.js", | ||
@@ -10,0 +10,0 @@ "main": "dist/mehdux.js", |
@@ -69,10 +69,25 @@ <div align="center"> | ||
### Subscribe to state changes | ||
```Javascript | ||
store.connect(console.log) | ||
store.connect()(console.log) | ||
store.actions.setValue('A cooler value') | ||
// logs { someValue: 'A cooler Value' } | ||
``` | ||
To subscribe to changes in certain parts of the state tree you can pass a function as the first argument to the `connect`-function. This is similiar to how you map state to props in `react-redux`. | ||
```Javascript | ||
const mapState = state => ({ | ||
interesting: state.something | ||
}) | ||
store.connect(mapState)(console.log) | ||
store.actions.setSomething('This is interesting') | ||
// logs { interesting: 'This is interesting' } | ||
``` | ||
### Usage with other frameworks | ||
@@ -79,0 +94,0 @@ `Mehdux` has built-in integrations with `react` and `preact`. |
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
47883
177