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

It doesn't appear to be possible to do much with Refs #78

Closed
iand675 opened this issue May 20, 2016 · 3 comments
Closed

It doesn't appear to be possible to do much with Refs #78

iand675 opened this issue May 20, 2016 · 3 comments

Comments

@iand675
Copy link

iand675 commented May 20, 2016

Refs is an opaque type, and there's no exported accessors to pull data out from Refs. Similarly, there doesn't seem to be any support in the Props module for establishing a ref in the first place. I'm using a 3rd-party component that has methods on it that need to be triggered from outside, and as best as I can tell, establishing it as a ref is the only real way to do that.

@paf31
Copy link
Contributor

paf31 commented May 20, 2016

You should be able to call getRefs in event handlers and lifecycle methods. The Refs type, however, is abstract, and you would have to access it using the FFI or some other approach like purescript-foreign.

@ethul
Copy link
Contributor

ethul commented May 21, 2016

I think it is a good point about the ref attribute.

From the docs, it looks like react supports adding a ref callback or a ref string. I think it may be useful to support these cases. Maybe we can add two functions in React.DOM.Props to support this? I'd be happy to add these or a PR also works.

Agreed that currently, the way to go about accessing the Refs type is via the FFI.

I wonder if it might be worth representing Refs as:

type Refs = StrMap ReactComponent

I am not sure if that would be the way to go or not, or how much it buys us, but we could define functions like focus that accept a ReactComponent, etc.

I am open to thoughts and ideas on this, or discussing it further.

@ethul
Copy link
Contributor

ethul commented Oct 11, 2017

Closed via #100

@ethul ethul closed this as completed Oct 11, 2017
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

3 participants