score:2
Accepted answer
a possible solution is to create a state and after the property is saved, change that state, in order to the components (icon colors and image) re-render.
example for state:
const [success, setsucess] = usestate(false);
example for image:
const sucessimage = <img src="/images/index/newimage.png" alt="save" />;
const defaultimage = <img src="/images/index/save.png" alt="save" />;
<div classname="saveaction">
{userid &&
<a onclick={saveclickproperty} classname="">
<div classname="actiondiv">
${success ? sucessimage : defaultimage} {' '} save
</div>
</a>
}
</div>
example of changing the state:
...
}).then((resp) => {
setsucess(true);
console.log("hello");
opennotification("", "property saved");
Source: stackoverflow.com
Related Query
- How to change image on button after click reactJs
- How to change page after login button click ReactJS
- ReactJs How to change an icon of a button on the click event?
- How to change image on button click with React Hooks?
- How to make only one button disabled on click in map method and how to change className after the timer expires in React?
- How to change language dropdown button image in react after dropdown menu link is clicked?
- how change state of several elements after click on button with React.js
- React How to change view after click on button
- how to make button click then image is opened using reactjs
- React doesn't re-render after State change on button click in ReactJS (preact)
- How to use array method to change different color on div in. In single button reactjs click
- How can i change font color for a snapchat login button after click on it?
- How to change button text in ReactJS
- how to add row to a table using ReactJS on button click
- How I can disable a button in React js for 5 seconds after click event
- How to change Cursor Icon upon button click on React
- How to get key attribute of parent div when button is click in ReactJS
- How to redirect to another page on button click in Reactjs
- How to get the time in seconds after click on submit button using React Count Down Timer
- react-konva How to change image after uploading?
- How to animate svg picture after a button click in React
- ReactJs change text upon button click problem
- how to change background color when I click the button using react hooks
- How to change the state value using a click button
- How can I create a button which Fetches image from API and download to the local with using ReactJs
- How to make carousel auto change instead of click onclick with loop on ReactJs
- How to reset input value after a button click that is not inside of a form in React.js
- How can I get multiple ckEditor by click on a button in ReactJS using Hooks?
- Change the Stripe Pay Button to An Image in Reactjs
- How to change heading tag upon button click using React?
More Query from same tag
- How to change the background color of the Chakra UI Toast component?
- React div style
- Prevent FullCalendar (React) from refetching events & resources on every render
- React Material-UI menu anchor broken by react-window list
- ReactJS & Firebase - Ordering data
- MapBox can't add react component on markers popup
- Detect which properties are used in code from json file
- What is the correct way to return map iterator from nested component?
- What should i test in this custom hook that is wrapping useSWR?
- react-switch doesn't call onChange when toggled to the initial state
- Repeat call to React Component every 60 seconds to automatically refresh front end display
- How to get index of the clicked images which is an item of array using React native
- React State only updates when setting a useless state variable along with the necessary state variable
- Moving an element in a circular path around a central point
- Async React.Component doens't work for me
- Nginx fails to resolve Upstream React JS files and falls back to index.html
- React- If uid not exist add to firestore collection
- ReactCrop cropping image with original resolution instead of the changed using CSS
- Reducer not returning updated state
- React tinymce troubles with setting variable to content parameter
- Redux Initial State from Server
- How can I apply classNames in react to change the background color of one of the child div in React
- Trouble fetching JSON from an Express API with React
- ReactJs trying to create a filter list
- how to do get react-phone-input-2 value by using react-hook-form in react
- Passing value from child to parent, after click event in child (which triggers function)
- .map is not a function React
- How to use import () to dynamically load components in React?
- React - refetch child component data when the props change
- Typescript: Discriminated Union with value in function parameter resolves to 'any'