Can a human colony be self-sustaining without sunlight using mushrooms? Similarly, the state cant be initialized without constructor class, when we initialize state outside constructor class again Bable read the syntax and understands there is a need to create constructor inside the class and do all the required hard works behind the scene. How to pass data from one component to other component in ReactJS ? mv fails with "No space left on device" when the destination has 31 GB of space remaining, Blamed in front of coworkers for "skipping hierarchy", Scientifically plausible way to sink a landmass, Short story about the creation of a spell that creates a copy of a specific woman. How to upload multiple images to nodemailer as an attachment? good spot! A class does and you cannot new an interface. How to change the state of react component on click. To create a static member you need to write the keyword static followed by the method definition in the class. How should I deal with coworkers not respecting my blocking off time in my calendar for work? I like @N. Kudryavtsev solution for anycodings_constructor creation smart instance factories anycodings_constructor (constructor wrapping with anycodings_constructor CreateCallableConstructor). The "Class constructor cannot be invoked without new" error occurs when the use x = X() instead of x = anycodings_constructor new X() The new operator does 3 How to communicate from parent component to the child component in Angular 9 ? I believe you can do this without a constructor: but if you want to instantiate with the constructor you can do this in the class. Where developers & technologists share private knowledge with coworkers, Reach developers & technologists worldwide.