Function components

Report a typo

You have learned that there are two ways to create a Functional component: using the keyword function and the arrow function syntax.

Take a look at the code snippets below and select only those that are correct.

A)

function App() (
  <p>Hello, world!</p>
);

B)

const App = () => (
  <p>Hello, world!</p>
);

C)

function App() {
  <p>Hello, world!</p>
}

D)

function App() (
  const string = 'world!';

  return (
    <p>Hello, world!</p>
  );
);

E)

const App = () => {
  const string = 'world!';

  return (
    <p>Hello, world!</p>
  );
}
Select one or more options from the list
___

Create a free account to access the full topic