braces around params -- why?

<>

This question already has an answer here:

Answers


This is the syntax for parameter object destructuring, which was introduced as part of ECMAScript 2015. The Todos function doesn't define a single parameter named todos, but instead accesses the todos property of an object that's passed in (and that is immediately destructured).

It is roughly equivalent to the following version:

const Todos = (_param) => {
  let todos = _param.todos;
  return (
    <div>
      <h1>Todos</h1>
      {todos.map(todo => <p key={todo}>{todo}</p>)}
    </div>
  );
};

Check out Destructuring and parameter handling for more information on destructuring.


Need Your Help

Remove comments from HTML templates using Maven

java html maven web-applications thymeleaf

Is there a standard and easy way how to remove comments from HTML templates (Thymeleaf) using a Maven plugin ? It would be nice if it can do this conventionally only for &lt;body&gt; content and le...