Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Global, client-side application state in Relay

What is the current recommendation or best practice for dealing with global application state in a Relay app? I have some state is strictly client-side (e.g. is the navigation panel open or closed) that I need to manage, as well as some RESTful data that isn't available through GraphQL.

I know that Relay 2 may solve this, but waiting "some time between Date.now() and Date.now() + Infinity" isn't an option ;)

like image 659
grahamb Avatar asked Nov 14 '16 18:11

grahamb


People also ask

How does relay Cache work?

Relay combines your React components with that's needed specifically for that component and renders it optimally to your frontend app. Now, the cache works by associating each piece of data with a unique ID.

Why use state management?

When you have state management in place data actually flows from your app to state and vice versa. You know exactly where your data is. These state management tools also give you a point-in-time snapshot of the entire data. In that way, you know exactly where your data is and that makes your development faster.

What is Relay in react native?

Relay is a framework for managing and declaratively fetching GraphQL data. It allows developers to declare what data each component needs via GraphQL, and then aggregate these dependencies and efficiently fetch the data in fewer round trips.

What is state management react?

What is React State Management? React components have a built-in state object. The state is encapsulated data where you store assets that are persistent between component renderings. The state is just a fancy term for a JavaScript data structure.


1 Answers

Add Redux ! The two of them colocates very easily, and this is what is done in the f8app.

like image 162
yachaka Avatar answered Dec 02 '22 21:12

yachaka