Git Product home page Git Product logo

reduxable's People

Contributors

gaguirre avatar ignacioola avatar jpgarcia avatar lndgalante avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

Forkers

tuck182

reduxable's Issues

Improve combineReducers function

Currently it is a little bit dirty.
Ideally it should accumulate the scope keys and set the scope just once for each Reduxable.

Handle errors avoiding crashes

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

Implement lifecycle hooks for:

  • component mount (will/did)
  • state update (will/did)
  • action dispatch (will/did)

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:

  • You can call a reducer in componentDidMount / stateDidUpdate
  • You can NOT call a reducer in componentWillMount / stateWillUpdate / actionWillDispatch / actionDidDispatch

In the case of actionWillDispatch and stateWillUpdate, see if should be possible to prevent them.

Use payload internally

So we can call this.dispatchers.someMethod(paramOfAnyType) and then in the reducer handle

reducers = {
  someMethod: (state, paramOfAnyType) => ...
}

Create HOC example

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.

Review redux dependency

Currently redux is a dependency and this causes some issues.
Would be great having it as a peerDependency instead, but need to be tested.

Add some examples

Consider creating a separate project (with separate repo) to demonstrate Reduxable features

Improve DX for store creation

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.

Dev-tools

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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.