form icon indicating copy to clipboard operation
form copied to clipboard

docs: add ESLint rule exception for react/no-children-prop

Open KwibooReese opened this issue 8 months ago • 3 comments

I ran into an error caused by ESLint and I have found that a few other people did too, I think it would be good to include this in the docs.

KwibooReese avatar Apr 14 '25 15:04 KwibooReese

Thoughts:

  • you do not have to write the code the same as in the docs/examples - you can keep the eslint-rule turned on
  • it is just one linting tool, would the docs end up listing all?
  • the rule is disabled in the tanstack-form repo - i would prefer if the same setting was set for the rule

Pascalmh avatar Apr 15 '25 06:04 Pascalmh

This is mostly preference and unrelated to tanstack form.

// These writing styles are equivalent in React
<Component children={(foo) => <Bar/>} />

<Component>
  {(foo) => <Bar/>}
</Component>

I think it's fine to add docs explaining this as I have seen others ask about it too. However, I think specifically targeting ESLint "erroring" is overkill. It's up to the user to decide if they want to enforce a certain way to write children functions or not.

LeCarbonator avatar Apr 15 '25 06:04 LeCarbonator

I changed the wording to mention

This is mostly preference and unrelated to tanstack form.

// These writing styles are equivalent in React
<Component children={(foo) => <Bar/>} />

<Component>
  {(foo) => <Bar/>}
</Component>

I think it's fine to add docs explaining this as I have seen others ask about it too. However, I think specifically targeting ESLint "erroring" is overkill. It's up to the user to decide if they want to enforce a certain way to write children functions or not.

I've reworded the original commit, let me know what you think. It could be good to add what you put in that message into the docs:

<Component>
  {(foo) => <Bar/>}
</Component>

I don't think it's entirely necessary to these proposed changes, but it would be helpful for newer devs.

KwibooReese avatar Apr 15 '25 12:04 KwibooReese