---
title: "Comment by Surjith S M on \"A neat way of building React components\" | Hashnode"
description: "I didn’t understand. Apart from using Typescript? What’s the benefit? Are you suggesting to use typescript for better components or to use enum ? If its not typ"
url: "https://hashnode.com/posts/a-neat-way-of-building-react-components/60229875aaa3543c903bfbc9/comment/6024de728a18494dfcecbf4e"
---

[Discussion](https://hashnode.com/posts/a-neat-way-of-building-react-components/60229875aaa3543c903bfbc9)

Comment [A neat way of building React components](https://hashnode.com/posts/a-neat-way-of-building-react-components/60229875aaa3543c903bfbc9)

[Surjith S M](https://hashnode.com/@surjithctly)

[Feb 11, 2021](https://hashnode.com/posts/a-neat-way-of-building-react-components/60229875aaa3543c903bfbc9/comment/6024de728a18494dfcecbf4e)

I didn’t understand.

Apart from using Typescript? What’s the benefit? Are you suggesting to use typescript for better components or to use `enum`? If its not typescript, how do we go about it.

Am I missing something?

[Telmo Goncalves](https://hashnode.com/@telmo)

[Feb 11, 2021](https://hashnode.com/posts/a-neat-way-of-building-react-components/60229875aaa3543c903bfbc9/comment/6024de728a18494dfcecbf4e#reply-6024ece68a18494dfcecc04c)

I'm using `enum` because of TypeScript though. If you're not using TS you can do:

```
export const sizes = {
  MD: 'md',
  // etc
}
```

The benefit is that you'll have the size names or button types all in the same place. If you need to change from `lg` to `large` you only need to change it in one place.

[Surjith S M](https://hashnode.com/@surjithctly)

[Feb 11, 2021](https://hashnode.com/posts/a-neat-way-of-building-react-components/60229875aaa3543c903bfbc9/comment/6024de728a18494dfcecbf4e#reply-602501a44d9e7d4dd727e29d)

[Telmo Goncalves](https://hashnode.com/@telmo) Oh Okay. Got it now. Thanks for clarifying.
