Skip to content

The demo about solid was wrong #288

Description

@akay-abc

Describe the bug

Hello,

I tried felte as my solidjs form library, however, in the process of trying, I was frustrated. According to the example on github's official website, I found that mistakes were reported anyway. Soon I realized that the writing of example was wrong.

For example:

solid

In this example, use:form appears, but this writing is not feasible in solidjs, the correct writing ref={form}.

import { createForm } from '@felte/solid';

function Form() {
  const { form } = createForm({
    onSubmit: async (values) => {
      /* call to an api */
    },
  });

  return (
    // error
    <form use:form>
      <input type="text" name="email" />
      <input type="password" name="password" />
      <button type="submit">Sign In</button>
    </form>
  );
}

The following is a corrected version

import { createForm } from '@felte/solid';

function Form() {
  const { form } = createForm({
    onSubmit: async (values) => {
      /* call to an api */
    },
  });

  return (
    <form ref={form}>
      <input type="text" name="email" />
      <input type="password" name="password" />
      <button type="submit">Sign In</button>
    </form>
  );
}

Hopefully, this error can be corrected to avoid discouraging web developers who want to use the library.

Which package/s are you using?

@felte/solid (SolidJS), @felte/reporter-solid

Environment

  • OS: macOS
  • Browser: Chrome latest
  • Version:
"@felte/reporter-solid": "^1.2.10",
"@felte/solid": "^1.2.13"

To reproduce

image image

No response

Small reproduction example

No response

Screenshots

No response

Additional context

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions