category: javascript

tag: javascript, JSON, loop

Posted on: May 4th 2021, 3:05pm

Last modified: May 4th 2021, 3:05pm

The following code snippet helps us to loop through JSON object.
import requests from "../utils/requests";

function Nav() {
  //   console.log(Object.entries(requests));

  return (
    <nav>
      <div>
        {Object.entries(requests).map(([key, { title, url }]) => (
          <h2>{title}</h2>
        ))}
      </div>
    </nav>
  );
}

export default Nav;

Recommended

HTML markdown cheatsheetInstall netlify cli globallyCustomizing font family and color in Tailwind.cssGenerate full version of tailwind.config.js fileEnable variant in the config file for Tailwind.cssSetup Tailwind workflowUsing @apply with Complex ClassesCustom animation in Tailwind.cssGradient in TailwindLoop through JSON object