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

Conversation

@nabilwardeh
Copy link

No description provided.

Copy link
Member

@kkarimi kkarimi left a comment

Choose a reason for hiding this comment

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

Good job! added some comments

constructor(props) {
super(props);
this.state = { searched: false };
this.bookingData = null;
Copy link
Member

Choose a reason for hiding this comment

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

Although as you have spotted you can do it this way, per the React pattern this data belongs to the state, i.e.
this.state = { searched: false, bookingData: null };

if (!this.props.bookingResults) return;
let elementId = e.target.id;

if (this.state.filter[elementId]) {
Copy link
Member

Choose a reason for hiding this comment

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

I don't believe this if () is ever true as you don't seem to update the filter in the state anywhere else? can you double check?

}
}

class SearchButton extends Component {
Copy link
Member

Choose a reason for hiding this comment

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

Using multiple components in a file can be a nice way to condense the number of files, but in a bigger project I'd say one file per component is probably best

this.setState({searched: true});
};

addNumberOfDays = () => {
Copy link
Member

Choose a reason for hiding this comment

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

Good job in breaking down the functions, makes it easier to read and write tests for

<Search search={this.search} />
{/* <Results results={this.state.results} /> */}
<Search search={this.search} runSearch={this.handleSearchButtonClicks} />
<Results bookingResults={this.bookingData} />
Copy link
Member

Choose a reason for hiding this comment

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

Should be per the commented out line, i.e.
<Results results={this.state.results} />

@nabilwardeh
Copy link
Author

Finished 9-10

@kkarimi kkarimi closed this Feb 26, 2018
Doris-Siu added a commit to Doris-Siu/hotel-booking-website that referenced this pull request Dec 5, 2022
AdrianIlovan added a commit to AdrianIlovan/cyf-hotel-react that referenced this pull request Jun 16, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants