I've got an error for using "Super(props)" in React Native

Viewed 189

when I was making an app following this tutorial, https://www.youtube.com/watch?v=5Fkx87SMoJc. I got an error;

enter image description here

I also saw some line on super(props); in VS code;

enter image description here

Here is my code please fix the problem by correcting my code because I'm still a beginner.

import React, { Component } from 'react';
import { AppRegistry } from 'react-native';
import Splash from './components/splash';
import Home from './components/index';

class Main extends Component {
  constructor(props) {
    super(props);
    this.state = { CurrentScreen: 'Splash' };
    console.log('Moving to next screen...');
    setTimeout(()=>{
      console.log('Done!');
      this.setState({ CurrentScreen: 'Home' });
    }, 3000)
  }
  render() {
    const { CurrentScreen } = this.state
    let mainScreen = CurrentScreen === 'Splash' ? <Splash /> : <Home />
    return mainScreen
  }
}

AppRegistry.registerComponent('App', () => Splash)

Thank you very much.

0 Answers
Related