react fun tion code example

Example 1: react fun tion

// it a component
import React from 'react';

class App extends React.Component {
      //call function (ECMAScript 5) from tag input:text
  handleChange = e => {
    //
    console.log(`${e.target.value}`)
  }
  render() { 
    return (
      
); } } export default App;

Example 2: create functional component react

import React from 'react'; const App = () => {  const greeting = 'Hello Function Component!';   return ;}; const Headline = ({ value }) =>  

{value}

; export default App;

Example 3: react props

Props is a way to transform data from one component to another.

 //IN component
  {this.props.numbre} // in html is 1

Tags:

Misc Example