Skip to main content

Posts

Showing posts with the label react

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...

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 ...