Skip to content

Commit 7e9ddc7

Browse files
React: fix useMemo (DevExpress#6870) (DevExpress#6872)
1 parent 6789798 commit 7e9ddc7

File tree

1 file changed

+3
-3
lines changed
  • concepts/50 React Components/45 Optimize Performance/05 Do not pass inline functions and objects as component props

1 file changed

+3
-3
lines changed

concepts/50 React Components/45 Optimize Performance/05 Do not pass inline functions and objects as component props/05 Object Literals.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,11 +72,11 @@ If you need to use objects, define them outside the component class or function
7272
// Correct: Object wrapped in `useMemo`
7373
function App() {
7474
// ...
75-
const options = React.useMemo({
75+
const options = React.useMemo(() => ({
7676
items: positions,
7777
searchEnabled: true,
78-
value: "CEO"
79-
}, []);
78+
value: "CEO",
79+
}), []);
8080

8181
return (
8282
<!-- ... -->

0 commit comments

Comments
 (0)