({url})
| 805 | } |
| 806 | |
| 807 | function Page({url}) { |
| 808 | const {items, updateItems} = useContext(ShoppingCartContext); |
| 809 | const onClick = useEffectEvent(() => updateItems([...items, 1])); |
| 810 | const numberOfItems = items.length; |
| 811 | |
| 812 | const onVisit = useEffectEvent(visitedUrl => { |
| 813 | Scheduler.log( |
| 814 | 'url: ' + visitedUrl + ', numberOfItems: ' + numberOfItems, |
| 815 | ); |
| 816 | }); |
| 817 | |
| 818 | useEffect(() => { |
| 819 | onVisit(url); |
| 820 | }, [url]); |
| 821 | |
| 822 | return ( |
| 823 | <AddToCartButton |
| 824 | onClick={() => { |
| 825 | onClick(); |
| 826 | }} |
| 827 | ref={button} |
| 828 | /> |
| 829 | ); |
| 830 | } |
| 831 | |
| 832 | const button = React.createRef(null); |
| 833 | await act(() => |
nothing calls this directly
no test coverage detected