Add useCallback when testing FunctionalComponent
This commit is contained in:
parent
ee6a6741ed
commit
65f8915dc1
@ -1,4 +1,4 @@
|
||||
import React from 'react'
|
||||
import React, { useCallback } from 'react'
|
||||
import ReactDOM from 'react-dom'
|
||||
import { Provider } from 'react-redux'
|
||||
import { createStore, Dispatch } from 'redux'
|
||||
@ -34,8 +34,10 @@ describe('pack', () => {
|
||||
}
|
||||
|
||||
function FunctionalComponent(props: IProps) {
|
||||
const update = useCallback(() => props.update(1, 'one'), [])
|
||||
|
||||
return (
|
||||
<button onClick={() => props.update(1, 'one')}>
|
||||
<button onClick={update}>
|
||||
{props.a + props.b}
|
||||
</button>
|
||||
)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user