All files / src/components/Filter index.tsx

66.66% Statements 4/6
100% Branches 0/0
50% Functions 1/2
66.66% Lines 4/6

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25        1x 2x 2x       2x                            
import React from "react";
import { useSetRecoilState } from "recoil";
import { filterState, } from "store/todo";
 
const Filter = () => {
    const setFilter = useSetRecoilState(filterState);
    const handleChange = (e: React.MouseEvent<HTMLInputElement>) => {
        const target = e.target as HTMLInputElement;
        setFilter(target.value);
    }
    return (
        <div onChange={handleChange}>
            <span>Show </span>
            <input type="radio" name="filter" value="All" id="all" defaultChecked />
            <label htmlFor="all">All</label>
            <input type="radio" name="filter" value="Done" id="done" />
            <label htmlFor="done">Done</label>
            <input type="radio" name="filter" value="Active" id="active" />
            <label htmlFor="active">Active</label>
        </div>
    )
}
 
export default Filter;