updated simpler task 3
This commit is contained in:
parent
b3def57dd2
commit
13f3fcdcd0
|
@ -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("");
|
||||||
|
|
Loading…
Reference in New Issue
Block a user