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

key property #101

Open
coot opened this issue Jun 28, 2017 · 1 comment
Open

key property #101

coot opened this issue Jun 28, 2017 · 1 comment

Comments

@coot
Copy link

coot commented Jun 28, 2017

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
Copy link
Author

coot commented Jul 1, 2017

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant