---
title: "Discussion on \"React Clean Code for Beginners\" | Hashnode"
description: "Discussion on \"React Clean Code for Beginners\". When I first started coding, what most caught my attention was the code pattern that is commonly used by Front-End developers, especially React developers. One of the things that I worked on the most was understanding how to architecture my entire pr..."
url: "https://hashnode.com/posts/react-clean-code-for-beginners/604eaf5937d84907f1329731"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [React Clean Code for Beginners](https://luisarbezerra.com/react-clean-code-for-beginners?utm_source=hashnode&utm_medium=feed)

When I first started coding, what most caught my attention was the code pattern that is commonly used by Front-End developers, especially React developers. One of the things that I worked on the most was understanding how to architecture my entire pr...

Mar 15, 2021 · 4 min read · luisarbezerra.com  
Updated Apr 17, 2021  
Read the article

-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#frontend-development](https://hashnode.com/tag/frontend-development)
-   [#frontend](https://hashnode.com/tag/frontend)
-   [#javascript](https://hashnode.com/tag/javascript)
-   [#programming-tips](https://hashnode.com/tag/programming-tips)

## Written by

[Luísa Ribeiro Bezerra](https://hashnode.com/@luisarbezerra)

@luisarbezerra · Madrid, Spain

  
[View profile](https://hashnode.com/@luisarbezerra)

Software Engineer

## Responses 8

Markdown supported · ⌘↵ to post

[Belinda Marion Kobusingye](https://hashnode.com/@belindamarionk)

[Oct 1, 2022](https://hashnode.com/posts/react-clean-code-for-beginners/604eaf5937d84907f1329731/comment/6337e198e594fa4ba3b8f69f)

Wow this is a timely help especially since React is my primary technology. Thanks again🤝

[Luísa Ribeiro Bezerra](https://hashnode.com/@luisarbezerra)

[Oct 1, 2022](https://hashnode.com/posts/react-clean-code-for-beginners/604eaf5937d84907f1329731/comment/6337e198e594fa4ba3b8f69f#reply-6338558dfa20fa4bc8e57613)

Nice to know, Belinda 😊

[Arthur Corenzan](https://hashnode.com/@haggen)

[Mar 16, 2021](https://hashnode.com/posts/react-clean-code-for-beginners/604eaf5937d84907f1329731/comment/60509854825b051f2b9dd335)

Hi Luiza, those are some great tips, thank you for this post!

Just one thing though. I would advise against the use of boolean `&&` over the ternary operator. Here's a cautionary tale: [kentcdodds.com/blog/use-ternaries-rather-than-and…](https://kentcdodds.com/blog/use-ternaries-rather-than-and-and-in-jsx/)

TL;DR is that the operator `&&` _might_ evaluate to the first value whereas the ternary will only evaluate to the explicit expressions you type in second and third positions. While the code is new and short it's clear to see, but once enough time has past and enough keyboards have touched it things get messier and bugs like these creep in.

Have a great day! ☺️

[Luísa Ribeiro Bezerra](https://hashnode.com/@luisarbezerra)

[Mar 16, 2021](https://hashnode.com/posts/react-clean-code-for-beginners/604eaf5937d84907f1329731/comment/60509854825b051f2b9dd335#reply-6050b012825b051f2b9dd603)

Oh lord! I'll add this info in the text :) thank you very much!

[Matheus Ribeiro](https://hashnode.com/@TheSirion)

[Mar 16, 2021](https://hashnode.com/posts/react-clean-code-for-beginners/604eaf5937d84907f1329731/comment/604ffd2c825b051f2b9dc446)

Great post! I liked specially the parts about how to organize imports (I already kind of did that but had no formal rule for this, I just absorbed it from what I had seem before), and the one about one-conditional rendering. It's great because ternary conditional expressions can look so damn ugly inside JSX code. I'm _definitely_ using this in the future!

By the way, it's not always that we see an article by a fellow Brazilian having so much traction inside the developer community! Great job! I'm looking forward for your next posts!

[Luísa Ribeiro Bezerra](https://hashnode.com/@luisarbezerra)

[Mar 16, 2021](https://hashnode.com/posts/react-clean-code-for-beginners/604eaf5937d84907f1329731/comment/604ffd2c825b051f2b9dc446#reply-60500768416f221f065b5b12)

Thank you SO MUCH for this comment! It for sure makes me wanna post every week hahahaha be my guest here :) anything you need please contact me!

[Smile Gupta](https://hashnode.com/@smilegupta)

[Mar 15, 2021](https://hashnode.com/posts/react-clean-code-for-beginners/604eaf5937d84907f1329731/comment/604f96f8825b051f2b9dbeae)

Amazing one [Luísa Ribeiro Bezerra](https://hashnode.com/@luisarbezerra) Totally loved it. ❤️ Just one question where can I find this **eslint-plugin-import** plugin? I checked in extensions of VS Code it was not there.

[Luísa Ribeiro Bezerra](https://hashnode.com/@luisarbezerra)

[Mar 15, 2021](https://hashnode.com/posts/react-clean-code-for-beginners/604eaf5937d84907f1329731/comment/604f96f8825b051f2b9dbeae#reply-604fa1a4416f221f065b55a9)

Hi dear! This plugin you need to install and you can follow the steps on this link: [github.com/benmosher/eslint-plugin-import](https://github.com/benmosher/eslint-plugin-import#installation)

Thank you again, and if you have any doubts just ask me :)

[Michele Masina](https://hashnode.com/@masinamichele)

[Mar 15, 2021](https://hashnode.com/posts/react-clean-code-for-beginners/604eaf5937d84907f1329731/comment/604f885e825b051f2b9dbd70)

The part about destructuring props is not completely correct. The second example shows:

```
const { name, age, phone } = props.user;
```

while the third example shows:

```
const UserCard = ({ name, age, phone })=> {
```

It should read instead:

```
const UserCard = ({ user })=> {
```

and be used as `user.name` or `user.age`, or even better:

```
const UserCard = ({ user: { name, age, phone } })=> {
```

and be used simply with `name` or `age`.

Other than that, good article. Thanks! :)

[Luísa Ribeiro Bezerra](https://hashnode.com/@luisarbezerra)

[Mar 15, 2021](https://hashnode.com/posts/react-clean-code-for-beginners/604eaf5937d84907f1329731/comment/604f885e825b051f2b9dbd70#reply-604f89e6416f221f065b539d)

Thank you Michele! I have already edited it, thanks to Arthur (and you, ofc). I didn't notice it while I was writing this post! So thank you again :)

[Arthur Brière](https://hashnode.com/@armuio)

[Mar 15, 2021](https://hashnode.com/posts/react-clean-code-for-beginners/604eaf5937d84907f1329731/comment/604f874e825b051f2b9dbd46)

Thank's for the article ! I juste have a little comment about this part :

```
const UserCard = ({ name, age, phone })=> {
```

On your previous examples, those props (name, age, phone) are children of props.user, not props directly.

But it's quite nothing !

[Luísa Ribeiro Bezerra](https://hashnode.com/@luisarbezerra)

[Mar 15, 2021](https://hashnode.com/posts/react-clean-code-for-beginners/604eaf5937d84907f1329731/comment/604f874e825b051f2b9dbd46#reply-604f8925825b051f2b9dbd8a)

Yeaah, good point, so based on this example, you must pass the props.user as "props". Thank you for collaborating :D

[Phiter Fernandes](https://hashnode.com/@phiter)

[Mar 15, 2021](https://hashnode.com/posts/react-clean-code-for-beginners/604eaf5937d84907f1329731/comment/604ebda337d84907f13297c4)

I'm a big fan of Vue.js, even being a contributor to some projects in its ecosystem, but for the past 8~9 months I've been working with React and even though I like many parts of Vue better, I think React is a powerful tool and the way components are handled is pretty neat.  
But if you're learning/working with React, I can't recommend Typescript enough.  
I was super scared of Typescript at first, always looked at it like "ugh" but once I started actually working with it, it just makes development so much better. It feels more professional, you get type safety in your components and nice DX powered by autocomplete in VSCode or other IDEs, for component props for example.  
So, learn React, make your code clean with the tips here but as soon as you can, try and add Typescript to your skillset. It will change your life.

[Luísa Ribeiro Bezerra](https://hashnode.com/@luisarbezerra)

[Mar 15, 2021](https://hashnode.com/posts/react-clean-code-for-beginners/604eaf5937d84907f1329731/comment/604ebda337d84907f13297c4#reply-604f5d927048cb1d6ea7ecf9)

Thank you, Phiter! It is nice to know how strong and good the typescript is, and how it helps the developer to write clean code! As soon as I have the chance to use it professionally, I will definitely be very happy :)

[Stela IS](https://hashnode.com/@stelais)

[Mar 15, 2021](https://hashnode.com/posts/react-clean-code-for-beginners/604eaf5937d84907f1329731/comment/604eb20d37d84907f1329751)

A clean code based on a clean post :)

Love the tips!!! I feel like my scripts will smell like lavender now!

[Luísa Ribeiro Bezerra](https://hashnode.com/@luisarbezerra)

[Mar 15, 2021](https://hashnode.com/posts/react-clean-code-for-beginners/604eaf5937d84907f1329731/comment/604eb20d37d84907f1329751#reply-604f5c297048cb1d6ea7ecaf)

Thank you again, Stela <3
