`key` property
coot opened this issue · 1 comments
coot commented
The key property is write only property, that can be placed on props, but react warns if you're trying to access it from within a component. It would be nice to find a proper way to encode this. Better than just adding key to property type. The simplest soluting would be to have an unsafe method:
setKey :: forall a. String -> a -> a
Another solution would be to have a a class with a setKey method, but then for every prop type one would have to implement it (maybe generic deriving could help with this).
Any other ideas?
coot commented
Instead of forall a. String -> a -> a we could just have forall r. String -> {|r} -> {|r}, that would be safer, but the Union type would be excluded.