Showing posts with label Constructor. Show all posts
Showing posts with label Constructor. Show all posts

Sunday, August 12, 2018

React Component Lifecycle - Constructor

The constructor is the first life-cycle method invoked when a React component is mounting / initializing. The following code snippet shows a basic constructor for a React component with state initialization and event binding.

Monday, May 27, 2013

Constructors

Constructors are methods of a class which get executed automatically when an instance of a class is created. The constructor method name should be same as the class name.

The following example defines a simple constructor for the class CEmployee