Reputation: 23
How can I create a stateless input component which has no business logic and it should be a complete stateless component where everything comes through props. No validation functions or any "intelligence".Validation should be done by the parent node for example. I would also want to make sure the properties are type safe, for example depending on which input_type we're using, there may be other additional properties (e.g. max/min value). Make sure these additional properties are only possible for the correct input_type (e.g. max/min value probably makes sense for input_type=number, but not for input_type=file) So the end result example I would want to create my input with type text and placeholder only by sending props, something like this:
<input type={InputType::Text} placeholder={"search:"}/>
I don't have that much experience with Yew or React, thus I am asking here, because I need this for a project to solve
Upvotes: 0
Views: 63