score:0
you should calculate the progress inside of the render function and you should do that based on the object from this.props.userdetails
directly, instead of assigning it to the this.therapist
property.
render = () => {
// ...
const therapist = this.props.userdetails;
let progress = 0;
if (therapist.phone) progress += 16;
// ...
return (
<div>
{ progress }
</div>
);
}
Source: stackoverflow.com
Related Query
- object state after submit button in react
- Doesn't re-render after button submit in react hooks if state updated
- React Bootstrap + Formik - show errors after I click submit button
- How to display the state on the same page when clicked Submit button in react
- "this" is undefined for a form after submit but not for button in react
- How to get the time in seconds after click on submit button using React Count Down Timer
- Why does react form's onSubmit fire after every keystroke, how to use enter button to submit form?
- Why won't the form state visibly change within the submit button using react form hook?
- How to manage state in a react button component on submit
- React form not displaying the correct inputs on the screen after I click submit button
- React update state of component after search through object
- React - Update state in class component based on text inputted by user after button click
- React - Clear form after submit with Context API state management
- How to prevent re render in react switch button after change button state
- React object won't update after biding to redux state
- React state gets updated only after I submit the form twice
- React doesn't re-render after State change on button click in ReactJS (preact)
- How to implement pagination of JSON state object in React after it loads
- display one question on radio button change and submit the user answer after every 3 questions react
- after setting the input field value to a state object with an empty value, now I can't type anything in the input field in the UI. i am using react js
- i want to store object in an array each time the submit button clicks but it stores single object in an array after every submit button
- react - state gets set to null after button click
- React not rendering after update state object
- clear controlled components in a form using react after clicking submit button
- Clear State After Submit React
- Trigger PHP script after submit button - using react js
- TypeError: Cannot assign to read only property 'value' of object react after using the value of state in a function
- How we can update the state of button to logout after successfull login in react redux
- REACT - auto submit form after files uploaded to state the contains array
- How do you submit a form after hiding the submit button in React
More Query from same tag
- jest enzyme test method in componentDidMount
- Handle void method as object's property in React unit test
- How to add onClick events in one loop and toggle class on corresponding elements in another loop?
- Web3: Cannot read properties of null after new ethers.Contract
- React rendering html table and reading from html table
- Wrapping <button>'s in <Link to=''> using react-router
- I don't understand how to append JSON object data to an Accordion
- How to toggle to show and hide in elements in Reactjs?
- Downloading Large Number of Files in Frontend using jszip
- Why does simply fetch data cause React Component to rerender
- How to send the date state of calendar to another calendar with Reactjs?
- How do I resolve "non-configurable property "ChoiceGroupOption" in a React.js app, I am using Parcel and imported comp from "office-ui-fabric-react"
- React hooks: maximum depth exceeded
- Mocha + React: navigator is not defined
- How to import and render svg file based on given name from variable in React?
- How to stream webcam feed on web page using react js component?
- How to conditionally set an onClick attribute to component without having to repeat lines of nested code?
- Accessing data from rest api with reactjs
- Array.splice works on both state sub-arrays
- How do I clear the textarea's value when clicked on the addbtn in reactjs?
- How to keep MUI accordion from expanding?
- React - getting inputs
- Meteor + React: Can't get data from mongoDB Collection
- React Native Hooks - How use useStates in Styles
- ReactJS: Converting simple example to Typescript
- Data not displaying when going to previous page next js application
- Getiing error TypeError: history is undefined while using React-router
- How to update UI without any given event in ReactJS
- Stop Race Condition of Refresh Token?
- React Class Component not working properly for me