小编Yan*_*ick的帖子

Dynamically create components in React

I am using react-icons and I have a JSON file as follows:

social: {
  twitter: {
    icon: 'FaTwitter',
    link: 'twitterlink',
  },
  linkedin: {
    icon: 'FaLinkedIn',
    link: 'linkedinlink',
  },
  github: {
    icon: 'FaGithub',
    link: 'githublink',
  },
}
Run Code Online (Sandbox Code Playgroud)

I am trying to dynamically create the icons by looping through the JSON, but I'm having a lot of trouble making it work.

Here are snippets of what I've already tried so far along with the outputs and the errors produced in the console: …

javascript reactjs

5
推荐指数
1
解决办法
7159
查看次数

标签 统计

javascript ×1

reactjs ×1