Answer the question
In order to leave comments, you need to log in
How to artificially limit the number of renders per second?
I have a component that receives data from the server, and due to the fact that the data changes very quickly, the component is rendered about 30 times per second.
Everything is as it should be, only in one component I need to limit the number of renders. Perhaps there is some way to manually set the component to render for example once a second.
This is a normal functional component that receives data as props.
import React from 'react'
function Component({ data }) {
return (
//here code
)
}
export default Component
Answer the question
In order to leave comments, you need to log in
Let the parent component control that this prop changes every N seconds + wrap the child component in React.memo
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question