Fast React


Lets build Avatar component
class Avatar extends React.Component {
render() {
return <img src={this.props.url} />;
}
}
You should change component to function
const Avatar = (props) => {
return <img src={props.url} />;
}
You don't need full component, you just need to render image!

Change your code
<Avatar url={avatarUrl} />
{Avatar({ url: avatarUrl })}
It give's you 45 % speed improvements!

https://medium.com/

Comments