How to use arrow function component in React JS

2 Answers

0 votes
import React from "react";
import { render } from "react-dom";

const App = () => {
  const s = 'Arrow Function';
  return <AFunction value={s} />;
};

const AFunction = ({ value }) => {
  return <h1>{value}</h1>;
};

render(<App />, document.getElementById("root"));



/*
run:

Arrow Function

*/

 



answered Apr 26, 2020 by avibootz
0 votes
import React from "react";
import { render } from "react-dom";

const App = () => {
  return <AFunction />;
};

const AFunction = ({ value }) => {
  const s = 'Arrow Function';

  return <h1>{s}</h1>;
};

render(<App />, document.getElementById("root"));



/*
run:

Arrow Function

*/

 



answered Apr 26, 2020 by avibootz
...