DEV Community

Discussion on: What's With All the Props Anyway?

Collapse
 
flrnd profile image
Florian Rand

Just want to mention that not every time we need to pass props. That's why functional components exist, like this one:

import React from 'react';

const Card = ({ id, name, email }) => (
  <div className="card-container">
    <img alt="Robot" src={`https://robohash.org/${id}?200x200`} />
    <div>
      <h2>{name}</h2>
      <p>{email}</p>
    </div>
  </div>
);

export default Card;
Enter fullscreen mode Exit fullscreen mode

Great article btw!

Collapse
 
laurieontech profile image
Laurie

Absolutely! And a great thing to point out. I wanted to focus on the boilerplate code in the cli and tutorials, but you're 100% correct that it can be overkill, and it's good to know about the alternatives!

Collapse
 
flrnd profile image
Florian Rand

I wasn't sure to leave the coment precisely because I thought about that too! But then I thought it's a good adition to your article 😁🖖

Thread Thread
 
laurieontech profile image
Laurie

Always leave the comment! Extra content in commens is what I live for :)