Kazuki Kimoto
Kazuki Kimoto

Reputation: 79

React native I do not understand the sentences

I just do not know how the code works below, mind if anyone can tell me how it's working this?? I do not understand especially "=>" what does this do?

React.Children.map(this.props.children, (child) => {};

Upvotes: 1

Views: 26

Answers (1)

Bonnie
Bonnie

Reputation: 195

This is an arrow expression. It creates a function. There's nothing in the curly braces, so no code will execute. It's part of JavaScript, not React Native-related.

For example, you could write a function named myFunction like this:

var myFunction = (name) => {
    console.log("Hello, " + name);
}

See the MDN docs for more info: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions

Upvotes: 2

Related Questions