function reactjs code example

Example 1: react functional components

const component = () => {
console.log("This is a functional Component");
}

Example 2: class component params in react

<input 
		type= "text"
     	value={ this.state.value || "" }
     	placeholder="Enter Name"
/>

Example 3: react function component

function Welcome(props) {
  return <h1>Hello, {props.name}</h1>;
}

Example 4: react native function

class Foo extends Component {
  handleClick() {
    console.log('Click happened');
  }
  render() {
    return <button onClick={this.handleClick.bind(this)}>Click Me</button>;
  }
}