skip to Main Content

This is a minor question
Can one define a div element in upperCase?

I tried using it and i have no errors in my project and as im definin a set element im getting no erros.

Can this syntax be used along side the standard one?

 <DIV className="pricing">
                {pricingPlans.map(plan      =>(
                    <p key={feature}>
                        <i className="ri-checkbox-circle-line"></i>
                        {feature}
                    </p>
                ))}
            </DIV>

2

Answers


  1. In HTML and JSX, tags are case-insensitive meaning that you can technically use uppercase tags like <DIV> instead of the standard lowercase <div>.

    However, it’s highly recommended to use the standard lowercase tags for consistency, readability, and to adhere to conventional coding practices.

    Using uppercase tags might not cause errors, but it can lead to confusion for other developers who read your code and expect standard practices. Additionally, some linters and code quality tools might flag this as an issue.

    That’s why we have to use lowercase for built-in JSX elements.

    <div className="pricing">
        {pricingPlans.map(plan => (
            <p key={plan.feature}>
                <i className="ri-checkbox-circle-line"></i>
                {plan.feature}
            </p>
        ))}
    </div>
    
    Login or Signup to reply.
  2. You can use uppercase tag names, and it’s not a big deal. However, the convention is to use lowercase tag names for better readability. So don’t worry, just go for it.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search