Expected corresponding JSX closing tag for input Reactjs

Sajin M Aboobakkar picture Sajin M Aboobakkar · Jun 15, 2015 · Viewed 113.4k times · Source

While creating a component in Reactjs with input fields error occurs Error: Parse Error: Line 47: Expected corresponding JSX closing tag for input at http://localhost/chat-react/src/script.js:47:20 </div>

var Main = React.createClass({
    render: function() {
        return (
            <div className="card-action">
                <i class="mdi-action-account-circle prefix"></i>
                <input id="icon_prefix" type="text" class="validate">
            </div>
        );
    }
});

Answer

Crob picture Crob · Jun 15, 2015

You need to close the input element with a /> at the end.

<input id="icon_prefix" type="text" class="validate" />