how to pass variable to component react code example
Example 1: class component params in react
<input
type= "text"
value={ this.state.value || "" }
placeholder="Enter Name"
/>
Example 2: react pass parameter to component
import React, { Component } from 'react'; class App extends Component { render() { return ( <div> <Greeting /> </div> ); }} class Greeting extends Component { render() { const greeting = 'Welcome to React'; return <h1>{greeting}</h1>; }} export default App;