Skip to content

Releases: icrosil/remob

Connector improve

01 Jul 17:03

Choose a tag to compare

This release simplify store injection into component.

Now you have 2 extra methods: connectRemob and setConnector.

First of all set your connector (for example one that react-redux provides) with next line

import { setConnector } from 'remob';
import { connect } from 'react-redux';

setConnector(connect);

And now you able to connect stores to containers really easy:

// assume 3 stores already exist named 'store1', 'store2', 'store3'
import { connectRemob } from 'remob'
import store2 from '../stores/store2'

const Component = props => <YourAwesomeComponent {...props} />;

// string store
connectRemob('store1')(YourAwesomeComponent);
// instance store
connectRemob(store2)(YourAwesomeComponent);
// object store
connectRemob({ store4: store2 })(YourAwesomeComponent);

Changes you may find breakable:

Now combineRemob throws error if you pass remob with duplicating keys.

Action with func powers!

04 Jun 21:51

Choose a tag to compare

So from this point actions are now access funs in first argument to dynamically change what part of store you would like to change!

  // functions supported, more dynamic for your needed flow
  @action(state => (Math.random() > 0.5 ? 'field' : 'deep.field')) changeRandomPart(state) {
    return Math.random();
  }

Debugging

19 May 12:51

Choose a tag to compare

Now with 0.4.1 version you can simply log what actions and selectors your remob has!

Just call yourRemob.debug(); to console.log out paths of actions and selectors registered.

why console.log? Simple and Lazy.

@action support

05 May 08:37

Choose a tag to compare

Added new feature for action creators.
Now @action supported and works just as @action().
This will produce all new state.

Nested actions added

12 Apr 12:38

Choose a tag to compare

From 0.2.1 version action path could be nested!

Consider next example

import { Reducer, action } from remob;

class Counter extends Reducer {
  initialState = {
    deep: {
      field: 42,
    }
   };

  // deep path exist, _.get powered.
  @action('deep.field') incrementDeepField(state) {
    return state.deep.field + 1;
  }
}

export default new Counter();

Field path will be used with _.get method, so object or array would work as is.