SyntaxError: Unexpected token '<'

I am just learning react at the moment! I have run into an issue recently where I keep getting

SyntaxError: Unexpected token '<'

The only thing that I have changed once creating the react app, was the text in the App.js file to the following:

import React from 'react';

function App(){
    return (
            <button>-</button>
            <span>0</span>
            <button>+</button>
       
    )
}
    

Tried a couple of things that Ive found on older posts, but none of them worked. Any suggestions would be greatly apprecaited!

Upvotes: 0

Views: 633

Answers (1)

dbonev
dbonev

Reputation: 402

import React from 'react';

function App(){
    return (
        <div>
            <button>-</button>
            <span>0</span>
            <button>+</button>
        </div>
    )
}

React component should return single element. In the current situation div

Upvotes: 2

Related Questions