Appropriate use of the new render prop? #9606
-
|
With the addition of the new
What about the following use-case though, is this considered a fair use of this new abstraction? (cc @devongovett) Eg for this FWIW, this specific use case does not lead to the warning in development, despite the mismatch taking place technically (unless the rule refers more specifically to cases like spreading One benefit of this new paradigm in relation to this example, is that I can use ...unless I dropped down to the hooks level and reimplemented the whole thing ground-up: |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
|
You can do that sometimes. You just need to adhere to the ARIA spec for the component. Usually extra wrappers are ok if they have What we mean by "Always render the expected element type" is that the dom props passed into |
Beta Was this translation helpful? Give feedback.
You can do that sometimes. You just need to adhere to the ARIA spec for the component. Usually extra wrappers are ok if they have
role="presentation"so that they don't affect the accessibility tree, and are generic elements like div/span and not something interactive. This is a little fuzzy so I would recommend running an accessibility checker like aXe to check.What we mean by "Always render the expected element type" is that the dom props passed into
renderneed to be attached to the expected element type. In your example,inputPropsneeds to be attached to an<input>element.