Questions tagged [react-usememo]

169 questions
-1
votes
1 answer

useMemo Critical dependency: the request of a dependency is an expression

First, I load a Redux-connected component using React.lazy and useMemo const Component = useMemo(() => lazy(() => import('./Component')), []); Then, I render it depending on my route with BrowserRouter like this:
Pe Wu
  • 533
  • 4
  • 12
-1
votes
1 answer

useMemo error after building app with npm run-script build

After i use npm run-script build on my react site and run index.html browser throws error TypeError: Object(...) is not a function on this part of code {useMemo(() => , [bom,db,skipParams,columnNameMap,tableColumnOrder])}. What should i do…
marek
  • 39
  • 4
-2
votes
1 answer

Is this valid syntax in React?

I am working on a React project and in there I have to initialize a socket once the component's been mounted. For that I am using this syntax and I want to know whether or not it is valid. function Component() { const socket = useMemo(() => { …
D_Gamer
  • 168
  • 12
-2
votes
2 answers

Render only components with changes

I have an array with thousands of strings and is passed to a component: Main component: const array = ['name1', 'name2', 'name3']; const [names, setNames] = useState(array); const onClick = (index) => { setNames(names.map((name, i) => { if (i…
Henny Lee
  • 2,970
  • 3
  • 20
  • 37
1 2 3
11
12