Skip to content

Conversation

@pablomarcel
Copy link

Week 3 HW Submission

Please fill out the information below in order to complete your assignment. Feel free to update this comment later if necessary.

  • Comfort rating on this assignment (1-5): 1|2|3|4|5
  • 5, React is Sweet!
  • Completion rating on this assignment: complete|incomplete
  • Complete

pablomarcel added 27 commits May 3, 2022 19:30
… shopping cart. need to fix total amount charged
…t for BnBForm. Will follow up with linting and PropTypes validation
key: PropTypes.number.isRequired,
onAdd: PropTypes.func.isRequired,

}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice use of components 👍

const [name, setName]= useState("")
const [isSuperhost, setisSuperhost]= useState(false)
const [stars, setStars]= useState("")
const [reviews, setReviews]= useState("")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This would be a good case where you could make an object to hold all of this state, and use one setter to set everything. Example:

const [form, setForm] = useState({
  houseType: '',
  image: '',
  ...
});

const setAttribute = (attribute, value) => {
  setForm({...form, [attribute]: value});
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants