Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

LONDON_10 || SAIM KORKMAZ || HOTEL REACT APP #617

Open
wants to merge 26 commits into
base: master
Choose a base branch
from

Conversation

nsaimk
Copy link

@nsaimk nsaimk commented Jul 11, 2023

No description provided.

nsaimk added 25 commits July 4, 2023 18:58
? 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.
@sonarcloud
Copy link

sonarcloud bot commented Jul 11, 2023

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

.new-booking button{
background-color: rgb(215, 213, 74);
}
.highlighted0{

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

  • elements that are second child of their parent

    https://www.dofactory.com/css/ref/selectors

  • .catch((error) => {
    setError(error.message);
    });
    }, []);

    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 });

    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]);

    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 = () => {

    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)
    

    @kitko112 kitko112 added the reviewed A volunteer has reviewed this PR label Jul 17, 2023
    Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
    Labels
    reviewed A volunteer has reviewed this PR
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    2 participants