ShakaCode | ShakaCode Blog | Rails On Maui Blog | Rails | ReactJs | JavaScript | Webpack | Productivity |

React error - ./src/App.js Line 16: Parsing error: Unexpected token


#1

Hello, I am a react beginner, i am doing the tutorial and i encountered an error.

This is the errror: ```
Line 16: Parsing error: Unexpected token


This is the code: 

    indent preformatted text by 4 spaces

    14 | 
    15 |           function formatName(user) {
    > 16 |             return user.firstName + user.lastName;
     |             ^
    17 |           }
    18 | 
    19 | 

My full code is: 

    function formatName(user) {
            return user.firstName + user.lastName;
          }


          const user = {
          firstName : 'Ciofliceanu',
          lastName : 'Serban'
          };





          const element = <h1>Hello, {formatName(user)}</h1>;

          ReactDOM.render(element, document.getElementById('root'));