Best practice in React JS

Sankalp BarriarSankalp Barriar
1 min read

When we are creating a component in react, make sure to keep its name starting with a capital letter as most of the utilities like vite, and create-react-app will throw an error.

here is the code snippet where App.js file is importing a jsx file Chai.js

function Chai(){
    return(
        <h2>Chai in react | </h2>
    )
}

export default Chai

App.js

import Chai from "./Chai";
function App() {
  return (
    <>
    <Chai />
    {/* APP is a function which is returning HTMl */}
    </>
  );                             
}

hope you find these articles fruitful with reference to https://youtu.be/yNbnA5pryMg?si=q9PNd9PWLu6T9F3q

2
Subscribe to my newsletter

Read articles from Sankalp Barriar directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Sankalp Barriar
Sankalp Barriar

I am a Full Stack React Developer from India.