score:2
Accepted answer
usememo
can be used to control when the value of a given variable inside a functional component should be recomputed, e.g.
const data = usememo(() => {
return [
...fetcheddata.map((val, i) => ({
no: val.row_number,
customerid: val.customer_id,
customername: val.customer_name,
podate: val.po_date,
branchid: val.branch_id,
passangerid: val.passanger_id,
passangerbank: val.passanger_bank_name,
passangerbankbranch: val.passanger_bank_branch,
created: val.createby,
})),
];
}, [fetcheddata])
Source: stackoverflow.com
Related Query
- Prevent react component from rendering twice when using redux with componentWillMount
- Prevent a specific attribute from rendering on DOM node in react js
- React - prevent lifecycle components from rendering the same data twice: WillReceiveProps & componentDidMount
- Prevent React from Rendering Child in Functional Component
- Prevent React from rendering inline styles
- How to prevent React from rendering the entire array when I append more items
- Rendering React Components from Array of Objects
- React - Prevent Event Trigger on Parent From Child
- How can I prevent my functional component from re-rendering with React memo or React hooks?
- Ignore or prevent ESLint errors from breaking the build in a React project (create-react-project)
- How to prevent child component from re-rendering when using React hooks and memo?
- How to prevent react from re-rendering the whole component?
- How can I prevent React from unmounting/remounting a component?
- How Prevent Multiple Copies Of React from Loading?
- Show the name of state variables from useState in React Developer Tool
- Prevent React from re-rendering a specific child component
- Prevent React from capturing tab character
- How to prevent React from recreating component tree on error?
- How to stop React from rendering comments
- How can I prevent a component from rendering before data is loaded?
- Prevent image from rerendering at every state change - React
- How to access environment variables in react from docker and webpack
- Can I pass environment variables from Gitlab .gitlab-ci.yml to a React app?
- React Native ListView TextInput locks up from performance optimization rendering
- Rendering React Components from an Object
- Rendering React components from json data dynamically
- React prevent remounting components passed from props
- How to prevent react router from re-rendering a previously rendered page?
- Preventing react from rendering unchanged componets into the virtual DOM
- How to prevent React from re-rendering the whole component
More Query from same tag
- How to correctly specify Route by: id on two conditions
- React Material UI – using UI Grid to split screen in half with one half scrollable and other half fixed
- Why React Doesn't Redirect to route?
- Set up cookie for the component in react.js
- ReactJS save submission from input for other API calls
- react js handling file upload
- Complete solution
- React Cursor jumping when formatting textfield
- React Router - Ignore / Redirect to subfolder
- Why does toJS() return an empty object when applied on observable object? - MobX
- Mixins and duplicate methods in React.js
- How to update the value of object properties inside array?
- Trouble with deep routes on a single-page app on Firebase hosting
- Dynamically populating dropdown based on 2 JSON files in React
- How to use redux to add todo item in todo list
- Next JS and Firebase authentication protected routes
- Onchange stops for every letter I type
- Jest Error: 'jest' is not recognized as an internal or external command, operable program or batch file
- React Router v4 replace history when component is unmounted
- How to set a loading state for react component while sorting and filtering data?
- Putting the defaultProps before a stateless component definition for the sake of readability
- Material UI ToggleButtonGroup
- Trouble while importing JSON Data to App.js
- AuthError - Error: Amplify has not been configured correctly
- Component didn't render when I setState in useEffect
- migrating php app to react with SSO
- *Help* Convert class to functional component using hooks
- Webpack check file exist and import in condition
- How send Event state to child of child component in React?
- How to fix Warning about React.forwardRef() after update Ant Design?