Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The demo about solid was wrong #288

Open
akay-abc opened this issue Apr 17, 2024 · 0 comments
Open

The demo about solid was wrong #288

akay-abc opened this issue Apr 17, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@akay-abc
Copy link

akay-abc commented Apr 17, 2024

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

@akay-abc akay-abc added the bug Something isn't working label Apr 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants