codedamn

Creating filter function

Created by Codedamn about a year ago

0

No description provided

1 Comment

    0
    const filterItems = (category) => {
    		
    
    		if (category !== 'all')
    			setMenuItems(menuItems.filter((item) => item.category === category))// error in this line
    		else {
    			setMenuItems(items)
    		}
    	}
    	```
    	This code technically should not pass the test case as if we click on breakfast and then shakes it the menuItems becomes empty with category='shakes'. But it is passing the testcases.
    
    @itzwow

    Amit Bera

    @itzwow

Your comment