Home > Back-end >  Showing the element's name or emoji on click in React, getting undefined
Showing the element's name or emoji on click in React, getting undefined

Time:08-15

Here is my component:

const Card = ({ _name, emoji, logger }) => {
  return (
    <div style={styles.wrapper}>
      <button onClick={logger}>-</button>
      <h4>
        {_name} {emoji}
      </h4>
    </div>
  );
};

And here is my App.js:

const arr = [
  { _name: 'Apple', emoji: '           
  • Related