Reactjs lowercase variable name for class name does not work?

I am new to ReactJS : i declare class like

var quiz=React.createClass{}..

this won’t work unless I change the variable to Quiz..only then it will work.
I am wondering is this requirement or may be I am missing out something?
I am using jsx and coding in sublime text

Here is Solutions:

We have many solutions to this problem, But we recommend you to use the first solution because it is tested & true solution that will 100% work for you.

Solution 1

In React, all components must have capital names, but your .jsx file can be lower case.

Here is the ReactJS documentation:

Always start component names with a capital letter.
React treats components starting with lowercase letters as DOM tags. For example, represents an HTML div tag, but represents a component and requires Welcome to be in scope.

Solution 2

React class names should start with a capital letter.
Also, try creating class like so:

class Quiz extends React.Component{
   // your code here

Solution 3

Actually this the fundamental of React that you should not name your component starting with smaller case letter.

This is how the react render method figure out that this is a user-defined component or predefined tag’s.

consider an example.

suppose you have made a component called img for getting Image on the page and you name that component in a smaller case then render method will get not take your component but it will render normal HTML img tag

so it you want to correct it you have name it as Img.

In your case, you can do like this

const Quiz = () =>{



class Quiz extends React.Component {


Note: Use and implement solution 1 because this method fully tested our system.
Thank you 🙂

All methods was sourced from or, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply