Connecting react native to redis db - reactjs

I'm trying to make a React Native application that needs to exchange data with a remote Redis server.
I've read on the web that I need to expose the redis API but I can't find anything about this.
The problem is that i keep getting results for react.js that is web and it's not what i'm searchng for.
Can someone write out a solution that i can adopt?

Related

How to understand data storage for a React app?

I am learning web dev and I am planning on developing a simple web app using React: a decision matrix tool. 
I need users to be able log in and save their matrices under their profile so I prefer to not use LocalStorage and thus learn more about databases. I am thinking of using JSON as the data format and I will also need to store basics user data for login and their profile.

I wonder how to tackle such a project since so far I have only been using GitHub Pages to host my static websites. Most of what I find by googling seems confusing or irrelevant for such a small-sized project.

My questions are:
What is the simplest way to store, access and edit JSON data as well as user data for a web app?
Are there any simple databases that can be “hosted” together with the app files on a server? Not sure if the question makes sense but I don’t understand where the database is.
What article or resource would you recommend to understand the concepts for data storage?
Ideally you would want to create a backend server using any language/framework e.g nodejs, java, django, php etc and expose the required data through APIs. But, if you don't want to create a separate backend app you can use Firebase database Firestore to save and fetch all of your required data. You can even use firebase hosting to deploy your app. Moreover, firebase also have their Authentication service which you can leverage for your app's authentication.

How to subscribe a Redis channel from a React Component

How can I subscribe a redis channel inside a React Component when it is mounted (i.e, inside the componentDidMount() ) ?
In the internet almost everywhere I see the redis implementation with nodejs but can't find any
sufficient hints how to use this in React App.
Actually I want to update my ecommerce dashboard (react app) data without refreshing the page. In the backend I used djangorest framework. When any API is fired to change any data the python code doing its work and also publishes a message in a specific Redis channel.
I want to subscribe that channel from the client (react app) so that it can consume this message and update it's content real time.
A react component (client technology) should not be able to access redis (server technology) for obvious security matters.
If you use react at server side to generate responses with react using node, that's node that should make this access.
If you want to access redis from a web front end (with a web browser), you must establish the following architecture:
React accesses a server using websocket and listens for messages.
The server in node js (using socket.io), in aspnet core (using signalR) access redis and communicate changes to the client thank to websocket technology.
If you want more details about how to do, you should describe that technology stack you use at client side.
But to make it short, for client side, the best is to use the redux observable stack. In this case, that would be an epic that would update the redux state whenever the server notifies something. If you are not comfortable with rxjs (this is very understandable!), then the easiest would be to use mobX (https://mobx.js.org/README.html)

Connecting ReactJs app to SpringBoot MVC/PostgresQL backend

I am developing a React app that needs to be connected to a backend server so that the user can login using Google OAuth, and then once that access token is granted, they are able to see the rest of the app. However, I am having a difficult time understanding just how to connect the front-end app to the backend. If someone could enlighten me on this, using SpringBoot MVC and PostgreSQL, that would be great. Thanks!
You have several ways to communicate your FE(React) and your BE(SpringBoot MVC).
You can have REST endpoint on your Backend, and then try to communicate from your react application, you can use [axios][1], request or the native fetch.
Then you can just make calls to the BE, and try to read, update, delete or create information, you should read about CRUD.
The most common this days is build something like this:
(FE) <---> (BE) <---> (DB)
But I strongly recommend you to read more about:
- React SPA.
- REST, you can also read about SOAP or even GraphQL.
- CRUD.
You will found a lot of tutorials with very good examples of how to do it.
Hope this helps you to understand a little more what approach to use.

Do I need other libraries than React.js to work with databases

I just started learning react. Now I want to build a small application where:
A user can Register/Log In (working with database)
The user can add items to a todo list
The todo list is stored in a database
Do I need other libraries to work with databases?
It's a small application.
Should I use Redux or rather something using MVC pattern like ASP.net?
I don't have any expierence with any of these. After lot of research I am still clueless on where to start with.
As you are a beginner. I would recommend you to use below libraries in both front-end and backend to start with your application
Front-end:
React - works as view layer
axios - to talk to backend database for all CRUD operations
Use localstorage or session storage to work between components. Because your application is very small so you can go with this approach or consider
using redux from now if you feel your application will grow bigger in
future
Back-end:
Keep your back end service as micro-services
As you are already working on react means you know something about javascript so I recommend you write your backend service in nodejs
If you want to use No SQL database then you can go with mongoDB database using mongoose in nodejs
If you prefer SQL database then I would recommend you to start with Postgres SQL database. Postgres SQL is popular these days than
any other SQL database
These are the required libraries for you to start.
I would recommend you to go for MERN stack i.e., MongoDB, Express JS, ReactJS and NodeJS

connect react native app with sqlserver

I already built a CMS website using ASP.NET MVC with SQLserver 2014,
and now i want to develop it into a mobile app using React Native, that I've been learning and playing with it's components for months now, but I don't know how connect the app with SQL server database. Is there anyway or solutions for connect React Native with SQL server database?
It is possible to connect a react native app with a remote MSSQL database using the react-native-mssql plugin (Android only at the moment).
Although it is best practice for security and performance to create an API interface there is nothing stopping you from connecting directly to the database if this suites your scope better than the API
You will have to create some sort of interface/API. The REST approach might be the correct one for your use case (manipulating data in a database).
Directly connecting to a SQL database from a mobile device is not recommended as the internet/network connection of a mobile device is prone to error and latency.
I would highly recommend you to make an API. The following points should explain you why:
Security (create an API with tokens or auth)
Error handling (your API should detect errors and send the correct headers)
Reusability (what if you want to connect another app or website to the database?)
Performance & API Management (you can control accesses and make statistics)
Once your API is finished, you can use it everywhere (fetch, axios, ...).

Resources