Open NightmanCZ90 opened 1 year ago
Could you share a link with the code at stackblitz?
If you want to use uncontrolled components (controlled by @modular-forms/solid
) you should not use the value
and onInput
properties together.
value
+ onChange
.defaultsValue
+ onChange
/onInput
.@juanrgm you are right. Thanks for your input. The following code example works:
<Field of={form} name="email">
{(field) => (
<TextField
variant="outlined"
inputProps={{
...field.props,
onChange: field.props.onInput,
}}
/>
)}
</Field>
For what reason do you use the name onChange
instead of onInput
as usual in SolidJS? And then what is the default onChange
event of SolidJS on the input element?
For what reason do you use the name onChange instead of onInput as usual in SolidJS? And then what is the default onChange event of SolidJS on the input element?
Because the concept controlled component
does not exist natively, it's inherited from React, where the behavior of the native onChange
is replaced for supporting the controlled value.
I understand the background with React. However, the name has nothing to do with whether the field can be controlled or am I wrong? onInput
might make more sense for the SolidJS implementation since that's the name most users expect.
All controlled components follow the same pattern (value
, defaultsValue
, onChange
).
I would need a proof of concept in React with MUI to see if there are any differences with SUID (example: input
event is not fired after change
).
Hello, I started SolidJS project with SUID and for forms I wanted to use Modular Forms for forms validation. But I got stuck on an issue, when passed field props do not match with TextField's props. Below is an example of TextField usage with Modular Forms.
It seems that your event handlers design does not match up with the default ones (for ).
So far I have used this workaround below. But my question is whether there is a correct way to use these libraries together?