Comments (5)
These are my codes:
import React from "react";
import styles from "./categoryList.module.css";
import Link from "next/link";
import Image from "next/image";
const getData = async () => {
const res = await fetch("http://localhost:3000/api/categories", {
cache: "no-store",
});
if (!res.ok) {
throw new Error("Failed");
}
return res.json();
};
const CategoryList = async () => {
const data = await getData();
return (
<div className={styles.container}>
<h1 className={styles.title}>Popular Categories</h1>
<div className={styles.categories}>
{data?.map((item) => (
<Link
href={"/blog?cat=style"}
className={`${styles.category} ${styles[item.slug]}`}
key={item._id}
>
{item.img && (
<Image
src={item.img}
alt=""
width={32}
height={32}
className={styles.image}
/>
)}
{item.title}
</Link>
))}
</div>
</div>
);
};
export default CategoryList;
from next-blog.
Look at the categories route.js, the problem is in fetching and passing that data. For example your category request should be ### const categories = await prisma.category.findMany()
;
from next-blog.
Look at the categories route.js, the problem is in fetching and passing that data. For example your category request should be ###
const categories = await prisma.category.findMany()
;
hii i am gettig empty prisma value
from next-blog.
Look at the categories route.js, the problem is in fetching and passing that data. For example your category request should be ###
const categories = await prisma.category.findMany()
;hii i am gettig empty prisma value
same...have you found any solution?
from next-blog.
This may happen if you dont receive any data from db incase you deployed on the server make sure to enter you server ip address in network access of mongodb, if not then you need to put your current ip address in network access of mongodb to receive data, or you could go with the option of any ( doesn't matter the ip address; you will recieve data but it is a security risk so change it to server ip address after deployment),
from next-blog.
Related Issues (20)
- Problem with prisma adapter, I suddenly have an 0auth callback error, and I'm in a loop of callbacks. HOT 3
- Popular category not redirecting to desired path HOT 3
- undefined data?user.name HOT 1
- dangerouslySetInnerHTML prop for a React DOM element should be in the form of {__html: ...} HOT 3
- views is not updating, can anyone help me ?
- problem in deploy
- A server-side exception has occurred HOT 1
- Prisma client error HOT 7
- I get this error and I am having trouble with signing in with google HOT 4
- getting document is not defined error while yarn build HOT 1
- Cannot read properties of undefined (reading 'page') HOT 1
- Issues with themeprovider HOT 2
- Facing error while doing npm run build HOT 2
- Deployment Failure on Vercel for /write Route with React Quill HOT 2
- Error: data?.map is not a function.. HOT 2
- Warning: Prop `className` did not match. Server: "null" Client: "light" HOT 1
- ⨯ TypeError: Cannot read properties of undefined (reading 'name') HOT 1
- I don't know where the problem is, the local storage is not working and the screen is white ? HOT 2
- Unable to fetch posts on production server, encountering client-side exceptions.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from next-blog.