-
-
Notifications
You must be signed in to change notification settings - Fork 768
LONDON_10 || SAIM KORKMAZ || HOTEL REACT APP #617
base: master
Are you sure you want to change the base?
Conversation
? const Example = (props) / ({order}). first one need a property ? "const [bookings, setBookings] = useState(); setBookings(FakeBookings);" gives the eroor "o many re-renders. React limits the number of renders to prevent an infinite loop. ", so instead the current syntax is used
Added a handy link, will come back later
Q. Why we use arrow function inside the onClick instead of only calling the function? --To avoid immediate invocation of the function. When the user clicks the button, the handleClick method is called.
Kudos, SonarCloud Quality Gate passed! |
.new-booking button{ | ||
background-color: rgb(215, 213, 74); | ||
} | ||
.highlighted0{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What elements are using these classes? if the styles are the same, one css class is enough.
if you want to style particular item in a list of item, you can try below class
li:nth-child(odd) // item with odd index
li:nth-child(even) // item with even indexx
li:nth-child(2) // All
.catch((error) => { | ||
setError(error.message); | ||
}); | ||
}, []); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice use of dependencies array in useEffect
|
||
|
||
const handleChange = (e) => { | ||
setNewBooking({ ...newBooking, [e.target.name]: e.target.value }); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A short and clear way to update the booking, Nice one
.then((data) => { | ||
setCustomerInfo(data); | ||
}); | ||
}, [id]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one, only the id change will trigger the useEffect
|
||
const Order = ({ orderType }) => { | ||
const [orders, setOrders] = useState(0); | ||
const orderOne = () => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI
another way to use the setOrders
setOrder((order) => order + 1)
No description provided.