In SSR, pages are rendered on the server at request time. When a user requests a page, the server generates the HTML on the fly, and then that HTML is sent to the client. This approach can improve SEO and provide a faster initial load for users since they receive a fully-rendered HTML page
In CSR, the page is rendered on the client side. The HTML is initially empty or minimal, and the browser fetches and renders data after the initial load. This approach is suitable for data that doesn’t require SEO or where fast updates are needed, like interactive dashboards.
"use client"
import React, { useEffect, useState } from 'react';
const Page = () => {
const [items, setItems] = useState([]);
console.log("items", items)
useEffect(() => {
const fetchData = async () => {
try {
const response = await fetch('https://dummyjson.com/products/categories);
if (!response.ok) {
throw new Error('Failed to fetch data');
}
const data = await response.json();
setItems(data);
} catch (error) {
console.error(error);
}
};
fetchData();
}, []);
return (
Categories
{items.map((item: any) => (
- {item.categoryName}
))}
);
};
export default Page;
Murmu Software Infotech is the top software, website & application development and SEO& digital marketing service provider company in Ranchi, Jharkhand.
Web Development | Website Builder | Ranchi Software Company | Web Builder | IT Software Company | Software Company in Ranchi | Web Developer | IT Company in Ranchi | Murmu Software Infotech | Software Service Companies | Ranchi IT Company | Website Developer in Ranchi | App Developer in Ranchi | App Developer Near Me | Application Software | Business Software | Infotech | IT Companies in Ranchi | IT Companies Ranchi | IT Company Ranchi | Mobile App Development | Software Companies in Ranchi | Software Companies in Ranchi Jharkhand | Software Company in Ranchi List | Software Developer | Software Development | Software Development in Ranchi | Software Development Near Me | Software Office Near Me | Top 10 IT Companies in Ranchi | Top Software Companies in Ranchi | Web Development Frontend | Website Designer in Ranchi | Website Designers in Ranchi | Website Developer | Website Development Company in Ranchi | Website Development in Ranchi | Website Maker