It's so funny that I'm using redux-orm but found it's hard to work with react-redux (though it's called redux-orm) on my end.
I got TypeError: Cannot read property 'Article' of undefined by using your method.
Let me sidetrack this question a little bit.
Is there any more popular ORM library than redux-orm, it's only has few examples on the internet.
Article.js
```
class Article extends Model {
static reducer(action, Article, session) {
switch (action.type) {
case 'load_all':
action.payload.forEach(articleData=>{
Article.create(articleData);
})
return session;
break;
}
return undefined;
}
}
Article.modelName = 'Article'
Article.fields = {
id: attr(), // non-relational field for any value; optional but highly recommended
name: attr(),
};
export default Article;
```
orm.js
const orm = new ORM ({
stateSelector: state => state.orm,
});
orm.register(Article);
ArticleList.js
const articlesSelector = createSelector(orm.Article);
const ormArticles = useSelector(state => articlesSelector(state, null));