Questions tagged [relayjs]

Relay is a JavaScript framework for building data-driven React applications

Declarative: Never again communicate with your data store using an imperative API. Simply declare your data requirements using GraphQL and let Relay figure out how and when to fetch your data.

Colocation: Queries live next to the views that rely on them, so you can easily reason about your app. Relay aggregates queries into efficient network requests to fetch only what you need.

Mutations: Relay lets you mutate data on the client and server using GraphQL mutations, and offers automatic data consistency, optimistic updates, and error handling.

Resources

Code: https://github.com/facebook/relay
Docs: https://facebook.github.io/relay/
Chat: https://reactiflux.slack.com/messages/relay/ (Get an invite here)

686 questions
14
votes
2 answers

Relay mutation expects data fetched by Relay

I have two Relay mutations that I'm nesting to first add an object then set its name. I believe what I'm passing to the second mutation is in fact data fetched by Relay, but it appears to disagree with me. The code in the React view is as…
logos
  • 143
  • 5
14
votes
3 answers

Using relay in react native app

How to expose a graphql endpoint to react native app? Has anyone used relay in react native application? The examples in technical overview of relay https://facebook.github.io/relay/docs/getting-started.html use webpack to serve relay app and expose…
14
votes
1 answer

Are there alternative libraries for Relay and GraphQL?

Facebook announced Relay and GraphQL. However, they are not available yet. Are there alternative libraries that accomplish similar goals that can be used today?
Michael_Scharf
  • 29,028
  • 15
  • 60
  • 87
13
votes
2 answers

How to dispatch an ad-hoc query, with Relay?

I'm new to Relay, still trying to wrap my head around it. Based on my understanding, Relay ties queries to components. This way, you can say that a component needs to be provided x, y and z from the GraphQL server. Based on my understanding, the…
Ryan
  • 6,875
  • 7
  • 50
  • 88
13
votes
3 answers

Why are edges required in a Relay/GraphQL Connection?

In a Relay/GraphQL schema configuration, one-to-many relationships (with pagination) are specified as in the tutorial example type ShipConnection { edges: [ShipEdge] pageInfo: PageInfo! } type ShipEdge { cursor: String! node:…
Michael Ho Chum
  • 919
  • 8
  • 17
13
votes
3 answers

relayjs: authentication using relay, which mutation to use?

I am currently handling authentication outside of relay with custom header set in DefaultNetworkLayer. Is it preferred way and Is there a way to do it in relay? I was stuck when trying to implement sign up functionality in relay: in relay there are…
almeynman
  • 5,906
  • 3
  • 19
  • 29
12
votes
2 answers

Relay Modern RefetchContainer props aren't passed to component

I'm having some issues setting up a refetchContainer in Relay Modern. A parent component is the QueryRenderer, which runs an initial query, populating the child component's props appropriately (a-prop-riately? eh? eh?!) . The refetchContainer…
cntrlz
  • 121
  • 6
12
votes
1 answer

Relay: How to merge instead of override queries in nested routes?

I cannot navigate to /users in my app, because it doesn`t trigger fetching of all queries that I would expect it should. My app consists of an App component and some components that contain actual content like Dashboard or UserList. There is also…
Michael Hilus
  • 1,316
  • 1
  • 17
  • 37
12
votes
4 answers

What's the easiest way to use Create React App with Relay?

I would like to use create-react-app without ejecting my Relay app. According to Relay documentation I will need the babel-relay-plugin. The relay-starter-kit configures this in a .babelrc. What would be the easiest way to accomplish this? Is there…
glennreyes
  • 1,854
  • 12
  • 18
12
votes
1 answer

Viewer in Relay.js

Why do you need and how to use viewer correctly in Relay.js? I've spent past week to try and understand Relay.js. Im now good with GraphQL and I understand it pretty well but Im having some issues with uniting GraphQL and Relay.js in same…
Solo
  • 5,383
  • 3
  • 25
  • 57
12
votes
2 answers

Is it possible to use Graphql generated schema as Flow definitions?

I have a project that uses the convo GraphQL, Relay and Flow. Is there a way to use GraphQL schema to feed Flow so the React props can be typed without redeclaring the types? For Relay I'm already using the script that generates two files:…
Blai Pratdesaba
  • 721
  • 1
  • 6
  • 11
11
votes
1 answer

Treating Relay.Store as a global store (i.e. redux store)

I'm refactoring (for fun, ha) my redux application to relay. In the redux application a failed event would dispatch an action with the failure message. This would be picked up by an 'Alert' reducer that would then present an alert to the user. This…
JBux
  • 1,378
  • 8
  • 17
10
votes
1 answer

Pass variables to fragment container in relay modern

I'm using Relay Modern (compat). I have a fragment that contains a field that has one argument, but I can't find a way of passing the variable value from the parent component: // MyFragmentComponent.jsx class MyFragmentComponent extends Component…
Maikel Ruiz
  • 1,023
  • 1
  • 11
  • 21
10
votes
1 answer

Relay Mutations: Mutating Paginated Associations

In a lot of cases we have mutations where there is a one-to-many or many-to-many association we need to mutate, and where the association is exposed to queries as a paginated list. There are a handful of critical requirements: Clients must be able…
XuoriG
  • 510
  • 3
  • 16
10
votes
2 answers

React Warning: Each child in an array or iterator should have a unique "key" prop. Check the render method of `App`

I'm getting that error, but I'm defining a key. Here's my App.js that it's complaining about. import React from 'react'; import Relay from 'react-relay'; import AccountTable from './AccountTable'; class App extends React.Component { render() { …
LoneWolfPR
  • 3,789
  • 12
  • 43
  • 78
1
2
3
45 46