• + 0 comments

    assuming that you've set up this state with:

    const [upvotes, setUpvotes] = useState(0);

    your function handling the click should call:

    setUpvotes(upvotes+1)

    while your upvotes display should just display {upvotes}

    This should trigger state setting and rerender immediatelly upon click.