({incrementBy})
| 144 | } |
| 145 | |
| 146 | function Counter({incrementBy}) { |
| 147 | const [count, updateCount] = useState(0); |
| 148 | const onClick = useEffectEvent(() => updateCount(c => c + incrementBy)); |
| 149 | const onMouseEnter = useEffectEvent(() => { |
| 150 | updateCount(c => c * incrementBy); |
| 151 | }); |
| 152 | |
| 153 | return ( |
| 154 | <> |
| 155 | <IncrementButton |
| 156 | onClick={() => onClick()} |
| 157 | onMouseEnter={() => onMouseEnter()} |
| 158 | ref={button} |
| 159 | /> |
| 160 | <Text text={'Count: ' + count} /> |
| 161 | </> |
| 162 | ); |
| 163 | } |
| 164 | |
| 165 | const button = React.createRef(null); |
| 166 | ReactNoop.render(<Counter incrementBy={5} />); |
nothing calls this directly
no test coverage detected