Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/andyrj/hyperapp-redux-devtools
hyperapp HOA to utilize redux-devtools-extension from hyperapp
https://github.com/andyrj/hyperapp-redux-devtools
Last synced: about 1 month ago
JSON representation
hyperapp HOA to utilize redux-devtools-extension from hyperapp
- Host: GitHub
- URL: https://github.com/andyrj/hyperapp-redux-devtools
- Owner: andyrj
- License: mit
- Created: 2017-06-26T03:42:10.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-06-17T20:23:14.000Z (over 6 years ago)
- Last Synced: 2024-09-21T22:06:29.278Z (3 months ago)
- Language: JavaScript
- Homepage:
- Size: 28.3 KB
- Stars: 36
- Watchers: 3
- Forks: 5
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- hyperawesome - andyrj/hyperapp-redux-devtools - Enables use of redux-devtools-extension for Hyperapp. (Utilities V1)
README
# hyperapp-redux-devtools
hyperapp HOA (higher order app) to utilize redux-devtools-extension from hyperapp```js
import { h, app } from 'hyperapp';
import devtools from 'hyperapp-redux-devtools';devtools(app)(
{ count: 0 },
{
increment: () => (state) => Object.assign({}, state, { count: state.count + 1 })
},
(state, actions) => {
return (
Click
{state.count}
);
},
document.body
);
```### Dev vs. Prod
When deploying a Hyperapp with this HOA, it is advised you don't ship the devtools bundle with it:
#### With Webpack Dynamic Import
```js
import { h, app } from 'hyperapp';let main;
if (process.env.NODE_ENV !== 'production') {
import('hyperapp-redux-devtools')
.then((devtools) => {
main = devtools(app)(...);
});
} else {
main = app(...);
}
```#### With Conditional Require (Rollup/Gulp/etc..)
```js
import { h, app } from 'hyperapp';
const devtools = process.env.NODE_ENV !== 'production'
? require('hyperapp-redux-devtools')
: null;let main;
if (devtools) {
main = devtools(app)(...);
} else {
main = app(...);
}
```