DEV Community

Discussion on: Senior Front-End Developers Share Advice for Juniors: What Would You Add?

Collapse
 
ashcript profile image
As Manjaka Josvah • Edited

Do you think it's right to use vanilla JS inside reactJS project sometimes while triggering events? I really need an advice about it because recently I did that with my chat app project... I haven't been able to figure out how to do with just ReactJS hooks and features that it provides, so I used a little vanilla JS code to handle what I really wanted to do and it worked. What do you think about that?

Thanks.

Collapse
 
dipanjan profile image
Dipanjan Ghosal

Typically you'd want to use React's facilities as much as possible instead of directly manipulating the DOM with vanilla js. However, for some edge cases, its absolutely fine to do so.
Just make sure its an exception rather than rule.

Collapse
 
kethinov profile image
Eric Newport

If there is a React feature to do what you're trying to do, and it's already a React project, then most likely the best way to go is to use the React way of doing it. It's important to use the best practices of the framework you're using.