---
title: "Discussion on \"Simplify your React code using shorter setState syntax\" | Hashnode"
description: "Discussion on \"Simplify your React code using shorter setState syntax\". In this article, we will see how we can use the new ES6 shorter syntax which will make the setState call a lot simpler. So Let’s start with some background knowledge.\nTake a look at below arrow function.\nconst getName = () => {\n return \"David\";\n}\nThe..."
url: "https://hashnode.com/posts/simplify-your-react-code-using-shorter-setstate-syntax/5fb0be9bb69caa470a3c3d43"
---

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

Discussion

# [Simplify your React code using shorter setState syntax](https://blog.yogeshchavan.dev/simplify-your-react-code-using-shorter-setstate-syntax?utm_source=hashnode&utm_medium=feed)

In this article, we will see how we can use the new ES6 shorter syntax which will make the setState call a lot simpler. So Let’s start with some background knowledge. Take a look at below arrow function. const getName = () => { return "David"; } The...

Nov 15, 2020 · 6 min read · blog.yogeshchavan.dev  
Updated Nov 16, 2020  
Read the article

-   [#javascript](https://hashnode.com/tag/javascript)
-   [#reactjs](https://hashnode.com/tag/reactjs)
-   [#es6](https://hashnode.com/tag/es6)

## Written by

[Yogesh Chavan](https://hashnode.com/@myogeshchavan97)

@myogeshchavan97 · India

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

Full Stack Developer | Freelancer | JavaScript | React | Nodejs. https://yogeshchavan.dev/. Book 1:1 @ hiretheauthor.com/myogeshchavan97

Full Stack Developer | Freelancer | JavaScript | React | Nodejs. Loves sharing knowledge through technical articles. Dev.to: https://dev.to/myogeshchavan97 https://linktr.ee/myogeshchavan97

## Responses 1

Markdown supported · ⌘↵ to post

[Darlan Tódero ten Caten](https://hashnode.com/@darlantc)

[Nov 15, 2020](https://hashnode.com/posts/simplify-your-react-code-using-shorter-setstate-syntax/5fb0be9bb69caa470a3c3d43/comment/5fb1512503f7294d0e3a864a)

Good content, I agree and already use the tips in my code.

The last example can be even shorter (and easy to read) because you are not using the _prevState_:

```
this.setState({ numbers: [] });
```

[Yogesh Chavan](https://hashnode.com/@myogeshchavan97)

[Nov 15, 2020](https://hashnode.com/posts/simplify-your-react-code-using-shorter-setstate-syntax/5fb0be9bb69caa470a3c3d43/comment/5fb1512503f7294d0e3a864a#reply-5fb1602b03f7294d0e3a874d)

Thank you [Darlan Tódero ten Caten](https://hashnode.com/@darlantc).

You're right, the last example can be further simplified as suggested by you because we're not using the previous state value.
