Check out example codes for "creating a stateful widget". It will help you in understanding the concepts better.

Code Example 1

class MyApp extends StatefulWidget {
  @override
  State<StatefulWidget> createState() {
    return _MyAppState();
  }
}

class _MyAppState extends State<MyApp> {
  @override
  Widget build(BuildContext context) {
    return Container(color: const Color(0xFFFFE306));
  }
}

Learn ReactJs, React Native from akashmittal.com