Hello! I’m using Next.js 14 and I’m new to Strapi. I’m having trouble finding a proper response, so I’m seeking help here.
Here’s how I’m fetching Strapi data on the server page:
const fetchBlogs = async (params) => {
const reqOptions = {
headers: {
Authorization: `Bearer ${process.env.API_TOKEN}`,
},
};
const request = await fetch(`${config.api}/api/blogs?populate=*&${params}`, reqOptions);
const response = await request.json();
return response;
};
const page = async () => {
const blogs = await fetchBlogs();
};
I have a child component with a list of buttons for each available category, and another child component with a list of blogs.
How can I filter the blogs from the page using the buttons in the child component? How can I change the fetch parameters from here ? and what exactly do I need to change? I’m confused.
Thanks for your help
This topic has been created from a Discord post (1256009851717292093) to give it more visibility.
It will be on Read-Only mode here.
Join the conversation on Discord