DEV Community

Cover image for Simple react tricks
Ifeanyi Chima
Ifeanyi Chima

Posted on • Edited on

Simple react tricks

react javascript tips and tricks

Ignore those words they are for S.E.O. I want to write some tips and tricks to use when coding a react app.

BMC

1. Naming

When naming a component you should use capital letters, for example: Header.jsx, Footer.jsx

2. Extension

When working with the Context API whether you are using typescript or javascript your component which contains the CONTEXT API should have the following extensions .tsx and .jsx respectively.

3. Unit testing

When writing unit tests in React when working with typescript, your file which contains the test should have the extension such as Header.test.tsx Why ? I don't know (It is the law) 🀣🀣🀣

Buy Me A Coffee

Thank you, please follow me

HTMLΒ GitHub

Top comments (0)