Based on this twitter thread from dan abramov React 15.2.0 will be adding a warning for props passed through to DOM nodes that aren't DOM attributes.
I don't _think_ this will have any implications on the API of this library. It only would if someone did something like this:
mount(<div foo />);
because we pass the props through, but at that point, that's their fault and issue to fix.
But internally, we do that a lot with our tests (see screenshot below). So effectively we need to update our tests to not put arbitrary props on DOM nodes.
This can be tested currently by installing [email protected]
There are a number of boolean HTML attributes that should be totally fine - <input checked />
for example - so hopefully React will maintain a whitelist of these, and not warn for them.
Similarly, any actual HTML attribute without a value, like <div foo>
, is sugar for <div foo="foo">
, so that warning would be a very bad idea.
If I'm misunderstanding, and it's solely a warning for actually-invalid HTML attribute names, then I'm on board :-)
You nailed it. We just have things like this in our tests <div amount={3} />
which react will warn for. But they do whitelist legitimate attributes.
We should just change those to data-amount
, data-foo
, etc.
Most helpful comment
We should just change those to
data-amount
,data-foo
, etc.