Skip to content

Commit 94ee613

Browse files
committed
improve useCallback dependencies
1 parent daf9d75 commit 94ee613

File tree

1 file changed

+2
-2
lines changed
  • frameworks/keyed/react-hooks/src

1 file changed

+2
-2
lines changed

frameworks/keyed/react-hooks/src/main.jsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ function listReducer(state, action) {
5555
const GlyphIcon = <span className="glyphicon glyphicon-remove" aria-hidden="true"></span>;
5656

5757
const Row = memo(({ selected, item, dispatch }) => {
58-
const select = useCallback(() => dispatch({ type: 'SELECT', id: item.id }), []),
59-
remove = useCallback(() => dispatch({ type: 'REMOVE', id: item.id }), []);
58+
const select = useCallback(() => dispatch({ type: 'SELECT', id: item.id }), [item.id]),
59+
remove = useCallback(() => dispatch({ type: 'REMOVE', id: item.id }), [item.id]);
6060

6161
return (<tr className={selected ? "danger" : ""}>
6262
<td className="col-md-1">{item.id}</td>

0 commit comments

Comments
 (0)