Skip to main content

Posts

2. Data fetching in NEXT JS application.

 NEXT JS provide us three method for data fetching. 1) Server Side Rendering (SSR) 2) Static Site Generation (SSG) 3) Incremental Static Generation (ISG)                                                                  Server Side Rendering (SSR)      Dynamic server render data. It fetch fresh data/content on each request. With SSR each request to server rendering new cycle for data fetching. It ensure always content up-to-date.                                                                  Static Site Generation (SSG) NEXT JS component directly/automatically data using API's and st...

1. What is Next js and why we need to use it in our projects ?

Next js Optimize your application in the way so you can render your pages/components extremely fast. Later on we will see how it works. So why we need NEXT JS. what does Next JS do that REACT doesn't ? 1) Next js simplifies the development process. 2) On top of that is optimize your web application. 3) Rendering: This is primary or main difference b/w react and next js. Rendering :  REACT JS render UI in client side and NEXT JS render UI in server side. NEXT JS also provide flexibility in rendering option. So question is...! What is client side rendering and server side rendering ? Client Side Rendering is browser rendering that happened in user devices. User ------> request to ----- Server Server send back the HTML/CSS/JS files in browser and execute the code and than finally show website  to user. Server Side Rendering : The web pages renders on server before transmitting it to the client device. User ------> request to -----Server it process the request and render the...

Error: MySQL shutdown unexpectedly

Follow the following step to recover your xampp server.  Rename folder  mysql/data  to  mysql/data_old Make a copy of  mysql/backup  folder and name it as  mysql/data Copy all your database folders from  mysql/data_old  into  mysql/data  (except  mysql ,  performance_schema , and  phpmyadmin  folders) Copy  mysql/data_old/ibdata1  file into  mysql/data  folder Start MySQL from XAMPP control panel

Redux in react native

 Step 1 Install the packages  -npm install @reduxjs/toolkit react-redux Step 2 Create a store by creating store.js file paste that default code inside that file import { configureStore } from '@reduxjs/toolkit' export const store = configureStore ({   reducer : {}, }) Step 3 Now wrap your application around with  <provider> by react-redux Go Inside your App.js file  import { Provider } from 'react-redux' ; import { store } from "./store" ; Now use that provider and store like so < NavigationContainer >       < Provider store = { store } >           < Stack.Navigator >             < Stack.Screen name = 'home' component = { HomeScreen } />             < Stack.Screen name = 'restaurant' component = { RestaurantScreen } />           </ Stack.Navigator >       </ P...

React packages mostly use in development

 1. Currency formatter -npm i react-currency-formatter 2. React native progress bars -npm install react-native-progress 3. React native animatable we can create text and gif animation in react native app. -npm i react-native-animatable 4. React native map -npm install react-native-maps NEXT JS To encrypt passwords -npm install bcrypt To install mongoDB -npm install monodb To manage the database -npm install mongoos To use authentication system -npm install next-auth

Setup sanity client in react

  Step 2. Crate a file with name sanity.js at root level of project. In side sanity.js write this code. import sanityClient from "@sanity/client" ; import { ImageUrlBuilder } from "@sanity/image-url" ; const client = sanityClient ({     projectId : 'qwoxusny' ,     dataset : 'production' ,     // to optimise cache if things not work     useCdn : true ,     apiVersion : "2021-10-21" , }); // now im going to make image url builder this will pull image urls // when i'm going to chnage/update image it provide the new url of // that image. const builder = imageUrlBuilder ( client ); export const urlFor = ( source ) => builder . image ( source ); export default client ; Step 3 . Add cors origin in sanity to white list hostnames. //  RUN this to add exception for localhost 300 CORS policy //  sanity cors add http://localhost:3000 /*     what is ther purpose od cross-origin: when we want to fetch ...

Technical errors

 Error 1: .ps1 cannot be loaded because the execution of scripts is disabled on this system Solution Set-ExecutionPolicy -Scope Process Unrestricted  works for me reference link: https://stackoverflow.com/questions/16460163/ps1-cannot-be-loaded-because-the-execution-of-scripts-is-disabled-on-this-syste  Reason for this error: My pc is on domain so there are many restriction all applied by admin. this is breaking backend processes while developing react-native app specially working with sanity.