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

Billboard image

Deploy and scale your apps on AWS and GCP with a world class developer experience

Coherence makes it easy to set up and maintain cloud infrastructure. Harness the extensibility, compliance and cost efficiency of the cloud.

Learn more

Top comments (0)

Cloudinary image

Optimize, customize, deliver, manage and analyze your images.

Remove background in all your web images at the same time, use outpainting to expand images with matching content, remove objects via open-set object detection and fill, recolor, crop, resize... Discover these and hundreds more ways to manage your web images and videos on a scale.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay