Skip to content

Using Immutable.js state with redux-localstorage #22

@localhosted

Description

@localhosted

I'm not sure how to setup the config parameter to properly use an Immutable object, This is how I configure the options:

import Immutable from 'immutable';

export const LocalStorageConfig = {
    serialize: (subset) => subset.toJson(),
    deserialize: (serializedData) => Immutable.fromJS(JSON.parse(serializedData)),
    merge: (initialState, persistedState) => initialState.mergeDeep(persistedState)
};

But I get an error with my selector, state.get is not a function :

export const menuSelector = createSelector(
    mainSelector,
        (state) => ({
            menu: state.get('menu')
    })
);

It looks like I'm missing something here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions