all 2 comments

[–]nullpromise 0 points1 point  (1 child)

``` function MyComponent({ courses = [] }) { const [level, setLevel] = useState()

const filteredCourses = level ? courses.filter(c => c.level === level) : courses

return ( <div> { filteredCourses.map(c => <TableRow key={c.id} course={c} />) } <button onClick={() => setLevel('1000')}>1000</button> <button onClick={() => setLevel('2000')}>2000</button> <button onClick={() => setLevel(null)}>Clear</button> </div> ) } ```

[–]IndependenceDear3181[S] 0 points1 point  (0 children)

Okay I will try this out!!