I want to make an input type global level so I created one component and i want to access it from another file. Here is an example...
Main File:
class User extends Component {
constructor(props) {
super(props);
}
render(){
return (
<CustomInput
refval = "username"
label = "Username"
classNameLabel = "pl0"
icon = "person"
/>
);
}
}
Component File:
class CustomInput extends React.Component {
constructor(props) {
super(props);
}
render() {
return (
<div className="col-sm-3 mt10">
<label className={"col-sm-12 "+this.props.classNameLabel}>{this.props.label}</label>
<div className="col-sm-12 pl0">
{(this.props.icon!=="" &&
<i className={"fa fa-"+this.props.icon+""}></i>
)}
<input type={this.props.type} ref={this.props.refval} className="form-control inputText" />
</div>
</div>
);
}
}
how I can archive this? Thank you so much in Advance :)