Should You Use Functional or Class Components?

Image for post
Image for post

What’s a Functional Component?

function Meow(props) {
return (
<div>
{props.cat} says, "Meow"
</div>
)
}
//or, using the arrow functions introduced in ES6const Meow = (props) => {
return (
<div>
{props.cat} says, "Meow"
</div>
)
}
class Meow extends Component {
constructor(props){
super(props)
}
render() {
return (
<div>
{props.cat} says, "Meow"
</div>
)
}
}

Why Should You Use a Functional Component?

They’re Easy to Understand

They Can/Will Have Better Performance

They’re Easy to Debug

They’re Easier to Reuse

When You Shouldn’t Use a Functional Component

Full-Stack Developer, Software Engineer, and UX/UI Aficionado

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store