score:1
If you just want the first channel every-time and only update it if the first channel changes, something like this should work:
React.useMemo(() => props.SetFirstChannel(Channels[0]), [Channels[0]]);
I set this up locally and checked. Let me know if it works. Cheers!
Source: stackoverflow.com
Related Query
- useEffect Setting Redux State multiple Times
- Prevent re-rendering when state is changed multiple times during useEffect
- UseEffect hook executes multiple times on updating state
- Setting state on array logs empty array multiple times
- React get state from Redux store within useEffect
- UseEffect being called multiple times
- Can a Redux action affect multiple parts of the state tree?
- React Native - Redux : Multiple instances of same state in app
- Redux mapStateToProps called multiple times
- Setting state along with AsyncStorage in useEffect hook causes infinite loop?
- Redux Sagas firing multiple times if injected in different containers
- How to use useEffect hook properly with array dependency. I passed state from redux store and still my component renders infinitely
- Redux actions/reducers vs. directly setting state
- Should you dispatch or call next multiple times inside of a Redux middleware?
- How to deal with UseEffect running multiple times due to retrieval from Firestore DB?
- React redux setting initial state from axios call
- React component table is being rendered multiple times or duplicated after updating state
- setting state inside useEffect
- Which is better practice for setting state in react redux
- Redux state shape for managing multiple React component instances?
- Setting initial state from Redux
- How to update React UI from with state in Redux store with useEffect
- Typescript - Setting the type for a null property, when defining the initial state in Redux
- How do I correctly add data from multiple endpoints called inside useEffect to the state object using React Hooks and Context API?
- How to prevent React Hook's useEffect from fetching data multiple times
- React.StrictMode: SetState function in useEffect is run multiple times when effect is run once
- Why does state not update correctly when calling setState() multiple times
- React redux - issues adding multiple items to an array in state tree object
- react redux using useSelector multiple times in app
- React: Setting input state inside useEffect not working
More Query from same tag
- React PrivateRoute authentication and unresolved token promise issue
- Apollo GraphQL requests are canceled
- React.js inserting multiple states into one main state
- React CSS - how to apply CSS to specific pages only
- Convert duplicative React code into a Higher Order Component w/o duplication?
- How do I loop through an array in javascript to get a new array whose length is not greater than 4?
- How to load a service worker using Webpack 5?
- Getting message: "Match failed [400]", errorType: "Meteor.Error" when using rocketchat methods(loadHistory) in Reactjs
- Material-UI TreeView - How to get the nodeId of the TreeItem that was clicked on?
- Trying to access API response from server on client-side
- What's the proper way to pass dependencies between components in React?
- When react really updated real dom in lifecycle
- How to run loader icon on deleted row rendered from a list in react?
- React context : state flow broken from Provider to Consumer
- React: Why does Babel not polyfill String.prototype.replaceAll?
- TooManyRequestsException while calling mediaconvert for updating job status in UI using javascript SDK
- Incrementing element Id with react and SSR (next.js)
- React .map built from 1 of 2 arrays
- React componentDidMount timing
- Removing a specific item from state
- How to add custom icon to tree and treenode
- Toggling a CSS class when a React.js component gets updated
- react-bootstrap Add Options to Select - ReactJS
- How to start a component in a loop and close it all 3 iterations
- React Cannot read property 'id' of null
- how to inset text of an array as innerHtml
- Reactjs - Assigning json response to default array
- redux-form: path.lastIndexOf is not a function error thrown while unmounting component due to "Object object" as form name
- React.js: Browser freezes whenever i tried to add a react component inside another component
- Is there any way to add an event listener in a method in a component A, and have the target in a separate component