Skip to content

Conversation

@jmaake
Copy link
Collaborator

@jmaake jmaake commented Feb 14, 2019

added a volunteering functionality

</div>
</div>
</div>
// <div className="col-12 Bookcard">

Choose a reason for hiding this comment

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

Add a TODO if you will use it in the future

this.getCountryCode( countries[countryCode]);
}

getCountryCode(country) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

You can wrap your method inside the componentDidMount function to ensure that the component is done mounting to the ReactDOM




componentWillMount() {
Copy link
Collaborator

Choose a reason for hiding this comment

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

There is a controversy regarding the call of fetch method in the componentWillMount.
One thing remains, your call is an asynchronous call that will only return when the render happens or later.
Your rendering won't be able to be paused waiting for the data to be displayed.
With this method you have better chances for your component to be empty first up until your data is rendered.
Since you have chosen this path, find a suitable way to grey out the field that are waiting to display data.
Else, you can use the componentDidMount

.then((response) => response.json())
.then(
(data) => {
console.log(data);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove the console

})
},
(error) => {
console.log(error);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove the console if you have more before pushing them

@@ -0,0 +1,9 @@
.btn-volunteer-title{
border-radius: 100px !important;
Copy link
Collaborator

Choose a reason for hiding this comment

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

The usage of !important has been preached to your peers.
Do not make use of it unless it is your last option

.then((response) => response.json())
.then(
(data) => {
console.log(data);
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove the console

console.log(data);
this.projects = data.map((item) => {

return (
Copy link
Collaborator

Choose a reason for hiding this comment

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

What are you returning?

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.

4 participants