minor fixes

pull/55/head
Asabeneh 4 years ago
parent f69a2bcfa3
commit 56f5f03913

@ -324,7 +324,7 @@ An array is a collection of different data types which are ordered and changeabl
#### How to create an empty array
In JavaScript, we can create an array in different ways. Let us see different ways to create an array.
It is very common to use _const_ instead of _let_ to declare an array variable. If you ar using const it means you do not use that variable name again.
It is very common to use _const_ instead of _let_ to declare an array variable. If you are using const it means you do not use that variable name again.
- Using Array constructor

@ -187,11 +187,12 @@ It is good to know these folders and files.
- node_modules - stores all the necessary node packages of the React applications.
- Public
- index.html - the only HTML file we have in the entire application
- favicon.ico - an icon file
- manifest.json - is used to make the application a progressive web app
- other images - can be used to open a graph image or for other purposes
- other images - open graph images(open graph images are images which are visible when a link share on social media)
- robots.txt - information, if the website allows web scraping
- src

@ -19,17 +19,25 @@
![30 Days of React banner](../images/30_days_of_react_banner_day_8.jpg)
- [State](#state)
- [What is State?](#what-is-state)
- [How to set a state](#how-to-set-a-state)
- [Exercises](#exercises)
- [Exercise: Level 1](#exercise-level-1)
- [Exercise: Level 2](#exercise-level-2)
# State
## What is State?
What is state ? The English meaning of state is _the particular condition that someone or something is in at a specific time_.
Let us see some states being something - Are you happy or sad? - Is light on or off ? Is present or absent ? - Is full or empty ? For instance, I am happy because I am enjoying creating 30 Days Of React challenge. I believe that you are happy too.
State is an object in react which let the component re-render when data changes. We do not directly change or mutate the state but we use the _setState()_ method. As you can see below in the state object we have count with initial value 0. We can access the state object using _this.state_ and the property name. See the example below.
State is an object in react which let the component re-render when state data changes.
## How to set a state
We set an initial state inside the constructor or outside the constructor of a class based component. We do not directly change or mutate the state but we use the _setState()_ method to reset to a new state. . As you can see below in the state object we have count with initial value 0. We can access the state object using _this.state_ and the property name. See the example below.
```js
// index.js

@ -282,7 +282,7 @@ Programming languages are similar to human languages. English or many other lang
I made a deliberate mistake. As a result, the console raises syntax errors. Actually, the syntax is very informative. It informs what type of mistake was made. By reading the error feedback guideline, we can correct the syntax and fix the problem. The process of identifying and removing errors from a program is called debugging. Let us fix the errors:
```js
console.log('Hello, World!')
console.log("Hello, World!")
console.log('Hello, World!')
```

Loading…
Cancel
Save