Currently we are building an app with react-native and fetching data such as login/signup etc handled within X-sdk we built.
Basically, what X-sdk is a middleware/api fetcher that communicates with back-end api and gets data for us.
To make app-development more simpler we handled token storing in the sdk using react-native/async-storage dependency. The issue is it is failing when we integrate sdk with web-app since it is not compatible with web-apps.
Is there any way to store the token locally for both app(react-native) and web-app.
react-native/async-storage dependency apply only react native if you want to use hlocalstorage
Related
I'm a react developer and I would like to learn backend (MERN stack). Before I learn Node, Express and Mongo DB (backend) which I can use with react (front-end) I explored Next JS a little bit(very little). I got to know Next JS is great and we can build the back-end in the Next JS app itself, I have a couple of questions here.
Let's say if I build a backend with Express and MongoDB to use in my React project, I can very well use the same backend to build my mobile app using the react-native app. However, if I use Next JS and build a backend within the same app then how can I use this backend built inside Next JS within my React-Native app?
Can I use already existing API like weather API/ currency converter API inside my Next JS app?
Sorry if this question is too silly.
Yes! you could build your App's backend in Nextjs itself.
Nextjs uses file-based routing. So, any file inside the folder pages/api is mapped to /api/* and will be treated as an API endpoint.
For example, when you create a file 'people.js' inside folder 'pages/api', it will be treated as an endpoint and you could access the endpoint by calling your_domain.com/api/people
Also, you can use external APIs in your app just like you do in other react apps.
I have to create an application where users will have their unique usernames and profiles like "website.com/JohnDoe". for that the client asked me to develop it in any good PHP framework and client also need an android/ios app (which he disclosed after 2nd meeting) . so I was(before 2nd meeting) going to use Laravel totally. but since he said he wanted a mobile app too, so I decided to use Laravel as backend API, for Web frontend I will use Reactjs and for Mobile I would use ReactNative ( I've done same before). since Laravel provides react support so my I was planning to use React within the laravel.
Then client said he is more concern about SEO of his website. so I had two options
Use laravel as API provider only. and create ReactJS app totally separate from Laravel.
In this case I will need Nodejs server. Then I thought If I have a nodejs server than why would I go for laravel, I could use Express.
Use ReactJS within laravel and use any SSR package to cope with ssr.
If I am going for second option, can anyone point me to already live website which uses React Helmet SSR or Laravel-react-ssr?
Laravel react-ssr: https://github.com/spatie/laravel-server-side-rendering
React Helmet-ssr: https://github.com/nfl/react-helmet#server-usage
I have read both, and I am too confused. I am beginner in both Laravel and React(node) so I am unable to understand what both are proposing.
i deployed your 2 option mentioned let me give you the site https://v3.topviewnyc.com/, i created a microservice which would take care of SSR besides my hooks and components are build on react so am totally able of enjoy the SPA frontend side with react using components and get data via laravels API
I've already built a create react app. I'm currently learning back-end development, and I was wondering how do I separated the scripts that are to run from the server from the scripts that run from the client? My app is currently deployed on heroku.
React js is a UI toolkit and does not have the ability to do server-side processing. If you want to add back-end functionality to your react app, you can build it separately in form of a REST API. (You can use nodejs, python, java etc. whichever suits your application)
You have to make API calls from your react app to receive and send data from front-end to back-end and vice versa.
I am new to web development I want to create an application using React and Django but all tutorials show that by using REST API.
is there a way to use Django and react without REST API and perform CURD.
I recommend also reading this blog post https://www.valentinog.com/blog/drf/, where Django and React are integrated via mini React apps inside Django templates.
I am not sure if it is the best approach, but may be useful.
React JS is a frontend JavaScript library. Whatever data is received by React from the backend, it's supposed be in JSON format and Django, if used without REST FRAMEWORK, doesn't pass JSON objects. It passes Query sets instead which are not acceptable and iterable in React. So, you have to use Django REST Framework, which makes use of serialisation and deserialisation for CRUD operations and hence creating REST APIs.
No, it's not possible.
Because even ReactJS is supposed to be on client side(Frontend). npm run build generates HTML/CSS/JS bundle for your app.
For backend, you might need node-express/Django rest... etc
HERE is complete guide to integrate your app.
Yes, you can do that with Django but in the end you need a API, no matter if it is REST or GraphQL because Django take care about the backend and React do all the stuff in the front end and you will need a way to connect both (and you do that by using an API)
I recommend you to use Django Rest Framework if you want to use a REST API or Graphene if you want to use a GraphQL API, here is a very cool tutorial to start with graphql.
I currently have a web app/api built using React, Node, Mongo & Express. I would also like to develop a react native clien that shares an API. Does having an existing react web client make the react-native mobile development any easier? My biggest concern is authentication & authorization. Can you recommend any tutorials, frameworks, packages that could make it easier? As you can tell.. I am very new to development.
You can utilize the same backend that you use for your Web app, in React-Native.
You can even use the same packages like Axios or superagent.
React-Native's built in one is called Fetch().
You are simply pinging your RESTful backend from a different device.
React-Native code is not at all a one for one with React Code. They are very different and only follow the same architecture Design Principals.
This question has been asked many times.