-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
React hooks status? #2792
Comments
There are a couple of open-source libraries that add hook support for a good bit of Relay functionality. Take a look at https://github.com/relay-tools/relay-hooks and https://github.com/relay-tools/react-relay-mutation. There are a few challenges in exactly matching the upcoming Relay hooks API. See relay-tools/relay-hooks#5 (comment) for more details. |
@taion I know about relay-tools/relay-hooks, however it probably does not make sense to use them, if they differ so much from the hooks implementation that facebook is using internally right now. They might release their hooks implementation tomorrow, and we'd have to make huge refactors to migrate our code - hence this question. I was hoping to get an ETA on whe to expect being able to use hooks with Relay, without having to write our own or use a custom library, such as relay-tools :-) |
You can always codemod |
Hooks got added few hours ago: b83aace |
@JohannesKlauss while they're added to this repository - they're not yet published to npm. |
But now they are with |
relay-experimental is taken on npm by another user |
@JohannesKlauss I've checked |
Oh sorry, yes. It's inside the |
So to confirm, there is no way to use them without building them manually from this repo at the current moment? Looking at frequency of npm publishes, it's sad :)
Anyway, IMO this issue should not be closed as hooks status seems unclear from outside user perspective |
@pie6k You can use this package: https://github.com/relay-tools/relay-hooks Also the release notes for 6.0.0 state, that those Hooks APIs are also very likely to change, hence they are experimental and not in the main package :). |
|
you can try relay hooks using experimental builds https://relay.dev/docs/en/experimental/a-guided-tour-of-relay#installation yarn add react@experimental react-dom@experimental react-relay@experimental |
@sibelius I try to avoid experimental if not dire needed. I have currently a solution which should be simple to migrate later when needed. Its tempting, but I pass out of experience. |
I got to correct my previous post. There were three issues that looked like one, one major on my side. Two resolved by the maintainer of the relay-hooks library very fast and the third by me. Other than this the hooks work perfectly well so far! |
Just started working with Relay and being used to working with modern React code (Context + Hooks), using render props and especially HoC seems like a step back in the stone-age.
So I'd really be interested in hearing about the status, and if possible and eta on a public hooks api? It would just make things a little more elegant ;-)
The text was updated successfully, but these errors were encountered: