Clean some code

This commit is contained in:
Jeremie Pardou-Piquemal 2020-07-31 21:36:22 +02:00 committed by Jérémie Pardou-Piquemal
parent 5f087a2def
commit 15a749ef70
2 changed files with 6 additions and 6 deletions

View file

@ -172,7 +172,7 @@ const Item = ({
loaded={loaded}
id={id}
>
<Component {...rest} x={0} y={0} setState={updateState} />
<Component {...rest} setState={updateState} />
</ItemWrapper>
</div>
);
@ -192,14 +192,14 @@ const MemoizedItem = memo(
}
);
const BaseItem = ({ setState, state }) => {
const BaseItem = ({ setState, itemId }) => {
const selectedItems = useRecoilValue(selectedItemsAtom);
const realState = useRecoilValue(ItemsFamily(state.id));
const state = useRecoilValue(ItemsFamily(itemId));
return (
<MemoizedItem
state={realState}
state={state}
setState={setState}
isSelected={selectedItems.includes(state.id)}
isSelected={selectedItems.includes(itemId)}
/>
);
};

View file

@ -9,7 +9,7 @@ const ItemList = () => {
const itemList = useRecoilValue(ItemListAtom);
return itemList.map((item) => (
<Item key={item.id} state={{ id: item.id }} setState={updateItem} />
<Item key={item.id} itemId={item.id} setState={updateItem} />
));
};