score:0
Accepted answer
<card.img>
is a img tag so you should update with as to change default element:
<card.img as="div">
<img src={res.imageurl} width="400px" height="150px" />
</card.img>
and you can add a variable to check component mounted or unmounted before call setstate
componentdidmount(){
this.mounted = true;
...
this.mounted && this.setstate({loading: false, data: fetcheddata});
...abortcontroller
}
componentwillunmount(){
this.mounted = false
}
Source: stackoverflow.com
Related Query
- Getting an error when trying to display images
- Getting this error , when trying to upload images through a form "TypeError: Cannot read property 'originalname' of undefined "
- am trying to display the gifs in ui by clicking on perticular gif, when am fetch the data by map am getting type error
- Getting an error that images is null while trying to show a preview of the uploaded images in react js
- getting bundle error when trying to load svg with raw-loader
- Object is possibly null error (typescript) when trying to display the value of an array which is stored in localstorage
- Getting error in Reactjs when using map to display JSON data?
- Getting error when trying to print out an object that has an array
- Getting an error when trying to trigger a function for state change
- When I am trying to import a custom hook function I am getting a typescript error
- Getting an error when trying to write a promise: Promise resolver object is not a function
- Getting Expected an assignment or function call and instead saw an expression no-unused-expressions error when trying to render a component in React
- Getting error unexpected use of history when trying to redirect?
- Getting ENOENT: no such file or directory, open... error when trying to move App.js/index.js files into subfolders inside /src folder
- Getting 415 error when trying to pass in multiple arguments to a get request in React with axios
- I'm getting a Cannot read property of 'exercises' of undefined error when trying to map my props
- getting "params.Body is required" error when trying to upload to s3
- when am trying to upload excel sheet it will uploaded successfully but am getting an error undefined offset: 500 in line 159
- Error when trying to .map over props in React-Redux when getting data from Firebase
- Getting Error When Trying to Render Page with React Hook
- How to fix an error when trying to display an error from the React server?
- Getting error `Type '{ theme: Theme; }' is not assignable to type` when trying to pass it as a prop to App component
- Getting TypeError: Object(...) is not a function error when trying to change a state property
- Getting error when i am trying to use constant when importing in React.JS
- Getting Heroku H10 Error when trying to deploy Strapi, MongoDB Atlas
- When I'm trying to build a new project with gatsby-cli, I'm getting error
- error display when trying to destruct array in React JS
- I am getting this error "Uncaught Error: Too many re-renders. React limits the number of renders to prevent an infinite loop." When trying the code
- Getting a 404 error when trying to get Express and React to connect
- the firebaseError error message display when trying to create new collection called message inside channelroom
More Query from same tag
- Configuring next.config file
- Can I use CSS to appear and then disappear the border after one click?
- React Component, Highstock: Synchronize multiple charts?
- React JS - trigger event on certain state value
- componentDidMount fires twice when using TransitionGroup for animation
- Is there any way that I can only show the hovered line in tooltip (Recharts)?
- API call was success but an alert shows as unsuccessful in React
- dispatch thunk return to component
- transitioning routes with additional props on <Match/> components with react router 4
- reactjs dropdown close the open menu
- How to find for the particular value in Object response type
- Unable to assign id to items fetched from firebase database
- How to make the image box under the button in React
- TS2322: Type 'NotRequiredArraySchema<string | undefined>' is not assignable to type 'Ref | Schema<string[] | Using Formik + yup validator
- Exported variable 'store' has or is using name '$CombinedState' from external module error Redux toolkit and redux persist
- ReactJS map onClick get value
- react component not re-rendering on state change from parent component firebase
- Conditionally add attributes as result of nested function to React components
- Can't get my form in React to work properly
- AJAX call not working in React once I change state
- How to setup routing so that it's redirected to Login if not authenticated?
- How to render the value of each key within the table?
- How to throw error instead of warning from proptypes in Reactjs?
- Putting a script widget in React
- How to update the state of child components to drag them around independently
- Next js custom server using express to route
- unable to set localstorage with product as the state initially changes
- Styled Component underline hover
- Warning: Functions are not valid as a React child. This may happen if you return a Component instead of <Component />
- React onclick handler for checkbox group