Young Scooter
Young Scooter

Reputation: 504

Normal ES6 class in React

Is it okay/bad practice for me to use a regular, plain 'ol javascript ES6 class in my React project, so that it does not extend component? I am wondering if this is bad to meddle with plain class instances using the new keyword. If so, what is the alternative if the class is purely functional with no UI?

Upvotes: 0

Views: 311

Answers (1)

element2562
element2562

Reputation: 38

I wouldn't say it's bad practice. In my projects I typically build a class for my API call methods to import into my components.

Upvotes: 1

Related Questions