Skip to content

Commit 5de572d

Browse files
committed
Remove unnecessary useCallbacks
1 parent 1033fa0 commit 5de572d

File tree

3 files changed

+17
-17
lines changed

3 files changed

+17
-17
lines changed

frameworks/keyed/rendrjs/package-lock.json

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

frameworks/keyed/rendrjs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"webpack-cli": "5.1.4"
1111
},
1212
"dependencies": {
13-
"@rendrjs/core": "0.1.198"
13+
"@rendrjs/core": "0.1.202"
1414
},
1515
"js-framework-benchmark": {
1616
"frameworkVersionFromPackage": "@rendrjs/core",

frameworks/keyed/rendrjs/src/App.js

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { rendr, useCallback, useState } from '@rendrjs/core';
1+
import { rendr, useState } from '@rendrjs/core';
22
import Jumbotron from './Jumbotron';
33
import Row from './Row';
44

@@ -36,29 +36,29 @@ let preloadIcon = rendr('span', {
3636
let App = () => {
3737
let [state, setState] = useState({ arr: [], sel: 0 });
3838

39-
let run = useCallback(() => setState({ arr: buildData(1000), sel: 0 }), []);
40-
let lots = useCallback(() => setState({ arr: buildData(10000), sel: 0 }), []);
41-
let clear = useCallback(() => setState({ arr: [], sel: 0 }), []);
42-
let update = useCallback(() => setState(old => {
39+
let run = () => setState({ arr: buildData(1000), sel: 0 });
40+
let lots = () => setState({ arr: buildData(10000), sel: 0 });
41+
let clear = () => setState({ arr: [], sel: 0 });
42+
let update = () => setState(old => {
4343
for (let i = 0; i < old.arr.length; i += 10) {
4444
old.arr[i].label += ' !!!';
4545
}
4646
return { ...old };
47-
}), []);
48-
let swap = useCallback(() => setState(old => {
47+
});
48+
let swap = () => setState(old => {
4949
if (old.arr.length > 998) {
5050
let one = old.arr[1];
5151
old.arr[1] = old.arr[998];
5252
old.arr[998] = one;
5353
}
5454
return { ...old, sel: 0 };
55-
}), []);
56-
let push = useCallback(() => setState(old => ({ arr: old.arr.concat(buildData(1000)), sel: old.sel })), []);
57-
let del = useCallback((id) => setState(old => {
55+
});
56+
let push = () => setState(old => ({ arr: old.arr.concat(buildData(1000)), sel: old.sel }));
57+
let del = (id) => setState(old => {
5858
old.arr.splice(old.arr.findIndex((d) => d.id === id), 1);
5959
return { ...old };
60-
}), []);
61-
let select = useCallback((id) => setState(old => ({ ...old, sel: id })), []);
60+
});
61+
let select = id => setState(old => ({ ...old, sel: id }));
6262

6363
return rendr('div', {
6464
class: 'container',

0 commit comments

Comments
 (0)