swordev/suid

How to use directives with SUID components?

Closed this issue · 1 comments

So the solidjs form validation example uses directives.

When I put a console.log into the validate function it gets printed for:

<input
  name="email"
  type="email"
  placeholder="Email"
  required
  use:validate={[emailInValid]}
/>

when I however put the use:validate on a <TextField> nothing happens:

<TextField
  name="email"
  type="email"
  placeholder="Email"
  component='input'
  required
  use:validate={[emailInValid]}
/>

Is there a trick on how to use directives with suid?

SolidJS directives

Important: use: is detected by the compiler to be transformed, and the function is required to be in scope, so it cannot be part of spreads or applied to a component.