Next.js Discord

Discord Forum

Static data storage

Answered
ABUL KALAM posted this in #help-forum
Open in Discord
Avatar
ABUL KALAMOP
Where should i put static data like these dashboard links?
const linksCategories = [
  {
    title: "uploads",
    name: "uploads",
  },
  {
    title: "group chats",
    name: "groupChats",
  },
  {
    title: "members",
    name: "members",
  },
  {
    title: "teams & others",
    name: "teamsAndOthers",
  },
];

const linksData = {
  uploads: [
    { text: "projects", href: "/admin/projects" },
    { text: "blogs", href: "/admin/blogs" },
    { text: "custom rates", href: "/admin/custom-rates" },
    { text: "product rates", href: "/admin/product-rates" },
  ],
  groupChats: [
    { text: "client groups", href: "/admin/client-groups" },
    { text: "customer support", href: "/admin/customer-support" },
  ],
  members: [
    { text: "clients", href: "/admin/clients" },
    { text: "users", href: "/admin/users" },
  ],
  teamsAndOthers: [
    {
      text: "roles, analytics & cities",
      href: "/admin/roles-analytics-cities",
    },
    { text: "team, about us & banner", href: "/admin/team-aboutus-banner" },
  ],
};
Answered by B33fb0n3
next itself don't have an opinion about that. So you can put it whereever you want to. I prefer putting it next to my component in the specific route. Like that you can group your data and find everything on one view 👍 @ABUL KALAM
View full answer

7 Replies

Avatar
ABUL KALAMOP
These links are to be diplayed like this
Image
Avatar
B33fb0n3
next itself don't have an opinion about that. So you can put it whereever you want to. I prefer putting it next to my component in the specific route. Like that you can group your data and find everything on one view 👍 @ABUL KALAM
Answer
Avatar
B33fb0n3
please mark solution
Avatar
B33fb0n3
Avatar
Eric Burel
the only problem you may have is if they end up in the client bundle
if you use them in a React Server Component, they are rendered directly as HTML, the end user will never see the JSON
but anyway for a small subset of data like the links you show it's ok to send them client-side too, not a big deal