These days we don't have to call the constructor inside the component - we can directly call state={something:""}
, otherwise previously first we have do declare constructor with super()
to inherit every thing from React.Component
class
then inside constructor we initialize our state.
If using React.createClass
then define initialize state with the getInitialState
method.