Skip to content

Instantly share code, notes, and snippets.

View darshan09200's full-sized avatar

Darshan Jain darshan09200

View GitHub Profile
@darshan09200
darshan09200 / state-inside-constructor.js
Last active March 8, 2021 06:50
This code helps to declare state variable inside and outside the constructor. You can use the state variable anywhere inside the using using this keyword.
class App extends Component {
/**
* Read more about creating constructor here:
* https://reactjs.org/docs/react-component.html#constructor
*/
constructor(props) {
super(props);
this.state = {
key: "value"
};