Groot
Groot

Reputation: 171

React throws error while using map function to render array of objects

my react application throws error when i am using map function. The similar code seems to be working fine when i use it in sandbox.
Error: ENOSPC: System limit for number of file watchers reached, watch So, After creating react project, the error is gone. but, when i use map function, it doesn't show anything. localhost:3000 is blank. but, when i comment out createEmojiCard function and use the same code inside app function. it works fine.

sample code:

import emojis from "../emojipedia";

function createEmojiCard(emoji){
  return(  <dl className="dictionary">
          <div className="term">
          <dt>
            <span className="emoji" role="img" aria-label="Tense Biceps">
              💪
            </span>
            <span>Tense Biceps</span>
          </dt>
        </div>
  </dl>
  );
}
function App() {
  return (
    <div>
      <h1>
        <span>emojipedia</span>
      </h1>
      {emojis.map(createEmojiCard)}

Upvotes: 0

Views: 124

Answers (1)

aisyahnnd
aisyahnnd

Reputation: 91

you can do a dependency update npm/yarn install, if it doesn't work maybe many different projects you open in VS Code, close another project and reload your VS Code

Upvotes: 1

Related Questions