Is it possible to use RelayJS and GraphQL without the ReactJS? - reactjs

I'm trying to figure out if there is a way of using RelayJS and GraphQL without ReactJS. Im quite fond of how those three works in data management and at the same time, im looking forward on using the jeasyUI for the design of my web application. But the problem is jeasyUI doesnt really work well together with reactJS.
Im a newbie on this matter so please, please please, if you guys know any way on how to work on it. Enlighten me please. Any response regarding this would be highly appreciated. Thanks in advance.

No, it's not possible to use Relay without React, but it's possible to use GraphQL without Relay.
Relay is just one of several GraphQL clients, there are others like Apollo client ( a client that supports React, Angular, React Native and any other frontend) and Lokka (a very simple client, without cache).

At present facebook only support relay to be used with react or react native + GraphQL. But they are working on it to make it framework agnostic. You can try Apollo Client which is the best alternative for Relay out there and also has lots of cool features, if you want to choose different tech stack other than facebook's.

Related

Exporting a React app/project to use it in another React project [duplicate]

I would like to know if it is possible to create a React project containing Redux library and then export it in another project? Until now, I only create components that display data. So I never wonder if it is possible.
The goal is to develop a little chatbot that communicates with an API. Then, this project will be used in several React projects.
Is it possible to do this? If yes, is it a good practice?
I have searched on the web and on Stack Overflowbut I didn't find any answer.
Sorry if the question has already been asked.
Thanks.
It is possible. A React component is a JavaScript function or a class. It can contain any JavaScript code. So a companent that is exported to other projects can manage its state using Redux.
Redux makes sense when the state handling is complex. Your component seems simple since all it does send data to an API and show received data. If you think it is complicated and that it would be difficult to implement it using pure React alone, you can use Redux.

Some Architecture advise for Reacjs with Apollo and Graphql (serius project)?

With our team, we are going to start a medium project with Reactjs + Apollo + Graphql and we are looking architecture pattern to keep an order on this project.
I was reading and watching some videos about Architecture for Reactjs and the most commented was Redux, seem good it have state managment and a file structure for work (like layers) but work better with Api Rest and we want to use Graphql.
The other option is use only Graphql and Apollo, because Apollo have it's own state managment and similar options that can replace redux, but if we use this option, what architecture can we give it? mvp? or mvvm? Is it posible with Reactjs?.
If some one with experencie with Reactjs can advise us, we would appreciate it =)
I think you should first understands the benefit of using ReactJs within your project. By saying this I mean to say that React and Redux are independent of each other. These are two different libraries.
React offers it's own benefits such as virtual DOM manipulation, lightweight, used with styled components and many more.
On the other hand Redux is kind of state management library that is based on centralized state management pattern and can be integrated with any JS framework.
With React you get the flavor of creating SPA's or even you can provide the illusion of SPA having multiple pages inside your App.
With React you can use other JS libraries without any obstacles as it is very user friendly and compatible with almost all latest browsers and even to aid the support there are various other libraries too.

What the optimize way to apply appsync subscription without using react-apollo to the react App?

I am doing a sample project with aws Appsync and ReactJs and my mutations are working fine. But I need a way to do the subscription part without using react-apollo. As far as I know Appsync is built based on apollo. So I believe there should be a way to do it purely with Appsync, by passing apollo.
I need some suggestions from expertise. Thanks in advance,
I tried with apoollo. But I need to do with minimum dependencies.
You can use the Amplify client https://aws-amplify.github.io/docs/js/api#amplify-graphql-client
I tried with apoollo. But I need to do with minimum dependencies.
You will always need a dependency since you will need a GraphQL client.
Here are some GraphQL clients that supports subscription aside from Apollo:
Relay
Amplify API
Since subscriptions are using web sockets under the hood, you can make use of Redux Saga's event channel.

Is it possible to develop a reusable react/redux project?

I would like to know if it is possible to create a React project containing Redux library and then export it in another project? Until now, I only create components that display data. So I never wonder if it is possible.
The goal is to develop a little chatbot that communicates with an API. Then, this project will be used in several React projects.
Is it possible to do this? If yes, is it a good practice?
I have searched on the web and on Stack Overflowbut I didn't find any answer.
Sorry if the question has already been asked.
Thanks.
It is possible. A React component is a JavaScript function or a class. It can contain any JavaScript code. So a companent that is exported to other projects can manage its state using Redux.
Redux makes sense when the state handling is complex. Your component seems simple since all it does send data to an API and show received data. If you think it is complicated and that it would be difficult to implement it using pure React alone, you can use Redux.

How to add react to a my express API?

I'm currently experimenting with Node/Express and I have so far created a very simple rest api.
My question is, now I am wanting to add React to the project and I am unable to find out how to do this effectively with keeping the MVC structure. I can't seem to find anything simple.
Any help/ tutorial guidance would be appreciated
Are you looking for Server Side Rendering. Redux community has a excellent guide about SSR. React Universal App (SSR base app ) has some complexity regarding API call because life-cycle hook are not called during server side rendering. Find more here

Resources