Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const [isActive, setActive] = useState(false)
- const btnSelect = () => {
- setActive(!isActive);
- }
- return (
- <div className='flex flex-col'>
- {
- button.map((cat, i) => {
- return (
- <button
- type="button"
- onClick={() => {
- filter(cat);
- btnSelect();
- }}
- className={`title w-32 h-16 my-2 ${isActive ? 'bg-sky-500' : 'bg-red-400'}`}
- >
- {cat}
- </button>
- )
- })
- }
- </div >
- )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement