nubescope / reduxable Goto Github PK
View Code? Open in Web Editor NEWReusable Redux, without boilerplate
License: MIT License
Reusable Redux, without boilerplate
License: MIT License
It fails when an object with keys holding null
values. The following will throw an error because of invalidKey
combineReducersWithReduxables({
validKey: 'this is valid',
invalidKey: null
})
Currently it is a little bit dirty.
Ideally it should accumulate the scope keys and set the scope just once for each Reduxable
.
Improve DX (for React at least) enqueuing the errors and showing them once the app is running.
Currently you can get some crashes if something fails when constructing the reduxables.
Implement lifecycle hooks for:
All should be local, meaning that will only be triggered with changes in each component. Then we can discuss if some global hooks are needed.
Also we should discuss what you can (and can not) do into each different hook. So far I can think in these rules:
In the case of actionWillDispatch and stateWillUpdate, see if should be possible to prevent them.
So we can call this.dispatchers.someMethod(paramOfAnyType)
and then in the reducer handle
reducers = {
someMethod: (state, paramOfAnyType) => ...
}
Taking advantage of #14 we could create HOC for different purposes. That would enforce the component concept.
For example, state persistence should be done in each component. Something like the following would be nice
@persistent
class SomeReduxable extends Reduxable {
...
}
Then the @persistent
HOC could use the componentDidMount
to rehydrate the state and the stateDidUpdate
to store a new one.
Currently redux
is a dependency and this causes some issues.
Would be great having it as a peerDependency instead, but need to be tested.
In Reduxable
components the state
should be named defaultState
or initialState
Consider creating a separate project (with separate repo) to demonstrate Reduxable features
It should work if createStore
is called directly with a Reduxable
(without calling combineReducers
)
Ideally we should have a method createStore
so we can do something like
class App extends Reduxable { ... }
const myApp = new App()
const store = myApp.createStore()
The idea would be call Redux's createStore(reducer, initialState, enhancers)
with the reducer
and initialState
we already have from the Reduxable instance and give the user the option to pass enhancers
.
What about middleware (logger) and store enhancers(dev-tools)? Promising for sure, the thing I like most about redux are the dev tools. What shows up as the action dispatch.
It could
setStore
Ideally #1 should be done first
To avoid duplicate code get dispatchers
should call internally to get actions
Internally it should dispatch an action and the reducer should return the initalState
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.