Relative Content

Tag Archive for rustyew

How to read a local file from a Yew component

I have a Yew component whose html output is completely defined by the data contained in a local file on the server disk.
I can’t read this local file (is the server sandboxed?)
Is there a way to read a file from a Yew component?

How to create a stateless input with Yew

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: