updated simpler task 3

This commit is contained in:
Jacob 2023-06-27 00:34:09 +02:00
parent b3def57dd2
commit 13f3fcdcd0

View File

@ -18,6 +18,15 @@ const filterDown = (filter: string) => (word: string) => String(word).includes(f
const filterItems = (items: any, filter: any) => items.filter(filterDown(filter)); const filterItems = (items: any, filter: any) => items.filter(filterDown(filter));
const mapItems = (filteredItems: any) => filteredItems.map((item: string) => <ListItemComponent itemNumber={item} />); const mapItems = (filteredItems: any) => filteredItems.map((item: string) => <ListItemComponent itemNumber={item} />);
function ListComponentAlternative(props: any) {
const mappedItems = props.items
.filter((item: string) => String(item).includes(props.filter))
.map((item: string) => <ListItemComponent itemNumber={item} />);
return <ul>
{mappedItems}
</ul>
}
const Task3: FunctionComponent = () => { const Task3: FunctionComponent = () => {
const [inputValue, setInputValue] = useState(""); const [inputValue, setInputValue] = useState("");