
Security News
CVE Volume Surges Past 48,000 in 2025 as WordPress Plugin Ecosystem Drives Growth
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.
reason-relay
Advanced tools
Use Relay with ReasonML/ReScript.
Are you using version
>= 0.13.0and ReScript syntax with VSCode? Make sure you install our decicated VSCode extension. Note: It only works with ReScript syntax.
Check out the documentation.
Also, check out the changelog - things will continue change some between versions (including breaking changes, although we'll try and keep them to a minimum) as we iterate and reach a stable version.
Your components define what data they need through %relay().
/* Avatar.res */
module UserFragment = %relay(
`
fragment Avatar_user on User {
firstName
lastName
avatarUrl
}
`
)
@react.component
let make = (~user) => {
let userData = UserFragment.use(user)
<img
className="avatar"
src=userData.avatarUrl
alt={
userData.firstName ++ " "
userData.lastName
}
/>
}
Fragments can include other fragments. This allows you to break your UI into encapsulated components defining their own data demands.
Hooks to use your fragments are autogenerated for you. The hook needs a fragment reference from the GraphQL object where it was spread. Any object with one or more fragments spread on it will have a fragmentRefs prop on it, someObj.fragmentRefs. Pass that to the fragment hook.
Avatar_user is spread right on the fragment, so we pass userData.fragmentRefs to the <Avatar /> component since we know it'll contain the fragment ref for Avatar_user that <Avatar /> needs. The <Avatar /> component then uses that to get its data.
/* UserProfile.res */
module UserFragment = %relay(
`
fragment UserProfile_user on User {
firstName
lastName
friendCount
...Avatar_user
}
`
)
@react.component
let make = (~user) => {
let userData = UserFragment.use(user)
<div>
<Avatar user=userData.fragmentRefs />
<h1> {React.string(userData.firstName ++ (" " ++ userData.lastName))} </h1>
<div>
<p>
{React.string(
userData.firstName ++ (" has " ++ (userData.friendCount->string_of_int ++ " friends.")),
)}
</p>
</div>
</div>
}
Finally, you make a query using %relay() and include the fragments needed to render the entire tree of components.
/* Dashboard.res */
module Query = %relay(`
query DashboardQuery {
me {
...UserProfile_user
}
}
`)
@react.component
let make = () => {
let queryData = Query.use(~variables=(), ())
<div> <UserProfile user=queryData.me.fragmentRefs /> </div>
}
FAQs
Use Relay with ReScript.
The npm package reason-relay receives a total of 48 weekly downloads. As such, reason-relay popularity was classified as not popular.
We found that reason-relay demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
CVE disclosures hit a record 48,185 in 2025, driven largely by vulnerabilities in third-party WordPress plugins.

Security News
Socket CEO Feross Aboukhadijeh joins Insecure Agents to discuss CVE remediation and why supply chain attacks require a different security approach.

Security News
Tailwind Labs laid off 75% of its engineering team after revenue dropped 80%, as LLMs redirect traffic away from documentation where developers discover paid products.