Commit ad32ba48 authored by Martin Fahl's avatar Martin Fahl

removes selector

parent 4fa1456a
......@@ -2,7 +2,6 @@ import React, { Component } from 'react'
import { connect } from 'react-redux'
import InventoryList from '../../components/InventoryList/InventoryList'
import { openAddDialog } from '../../actions'
import { createSelector } from 'reselect'
class InventoryListContainer extends Component {
render() {
......@@ -12,22 +11,8 @@ class InventoryListContainer extends Component {
}
}
const getItems = state => state.items;
const getFilterTerm = state => state.filterTerm;
const getItemsFilteredByTerm = createSelector(
[getFilterTerm, getItems],
(filterTerm, items) => {
if (filterTerm === undefined) {
return items;
} else {
return items.filter(item => item.name.toLowerCase().includes(filterTerm.toLowerCase()));
}
}
)
const mapStateToProps = state => ({
items: getItemsFilteredByTerm(state)
/* TODO map items */
})
const mapDispatchToProps = dispatch => ({
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment