Skip to content

Commit 540ebee

Browse files
authored
Merge pull request #216 from mbinou/fix-typo
fix: correct some typos in README
2 parents d04109e + 636d4d3 commit 540ebee

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

README.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -513,15 +513,15 @@ You can download the PDF and Epub version of this repository from the latest run
513513
6. ### When to use a Class Component over a Function Component?
514514

515515
If the component needs _state or lifecycle methods_ then use class component otherwise use function component.
516-
516+
517517
_However, from React 16.8 with the addition of Hooks, you could use state , lifecycle methods and other features that were only available in class component right in your function component._
518518
_So, it is always recommended to use Function components, unless you need a React functionality whose Function component equivalent is not present yet, like Error Boundaries._
519519

520520
**[⬆ Back to Top](#table-of-contents)**
521521

522522
7. ### What are Pure Components?
523523

524-
_`React.PureComponent`_ is exactly the same as _`React.Component`_ except that it handles the `shouldComponentUpdate()` method for you. When props or state changes, _PureComponent_ will do a shallow comparison on both props and state. _Component_ on the other hand won't compare current props and state to next out of the box. Thus, the component will re-render by default whenever `shouldComponentUpdate` is called. In functional componenets we use `React.memo()` API. `React.memo()` is a higher-order component. It takes a React component as its first argument and returns a special type of React component that allows the renderer to render the component while memoizing the output. Therefore, if the component’s props are shallowly equal, the `React.memo()` component will bail out the updates.
524+
_`React.PureComponent`_ is exactly the same as _`React.Component`_ except that it handles the `shouldComponentUpdate()` method for you. When props or state changes, _PureComponent_ will do a shallow comparison on both props and state. _Component_ on the other hand won't compare current props and state to next out of the box. Thus, the component will re-render by default whenever `shouldComponentUpdate` is called. In functional components we use `React.memo()` API. `React.memo()` is a higher-order component. It takes a React component as its first argument and returns a special type of React component that allows the renderer to render the component while memoizing the output. Therefore, if the component’s props are shallowly equal, the `React.memo()` component will bail out the updates.
525525

526526
**[⬆ Back to Top](#table-of-contents)**
527527

@@ -4319,9 +4319,9 @@ You can download the PDF and Epub version of this repository from the latest run
43194319
href="../../bower_components/polymer/polymer.html"
43204320
/>;
43214321
Polymer({
4322-
is: "calender-element",
4322+
is: "calendar-element",
43234323
ready: function () {
4324-
this.textContent = "I am a calender";
4324+
this.textContent = "I am a calendar";
43254325
},
43264326
});
43274327
```
@@ -4331,7 +4331,7 @@ You can download the PDF and Epub version of this repository from the latest run
43314331
```html
43324332
<link
43334333
rel="import"
4334-
href="./src/polymer-components/calender-element.html"
4334+
href="./src/polymer-components/calendar-element.html"
43354335
/>
43364336
```
43374337
@@ -4342,7 +4342,7 @@ You can download the PDF and Epub version of this repository from the latest run
43424342
43434343
class MyComponent extends React.Component {
43444344
render() {
4345-
return <calender-element />;
4345+
return <calendar-element />;
43464346
}
43474347
}
43484348
@@ -6868,7 +6868,7 @@ const loadUser = async () => {
68686868
332. ### What is the difference between useState and useRef hook?
68696869
1. useState causes components to re-render after state updates whereas useRef doesn’t cause a component to re-render when the value or state changes.
68706870
Essentially, useRef is like a “box” that can hold a mutable value in its (.current) property.
6871-
2. useState allows us to update the state inside components. While useRef allows refrencing DOM elements.
6871+
2. useState allows us to update the state inside components. While useRef allows referencing DOM elements.
68726872
68736873
**[⬆ Back to Top](#table-of-contents)**
68746874
@@ -6956,7 +6956,7 @@ function App() {
69566956
```
69576957
69586958
<h4> Props in Class Component</h4>
6959-
Props are referred to as "properties". props are passed into react component just like arguments are passed into functions . Props are being specified as attribute just like your html. for example if the name attribute is "name " we assign a value to name. so basically, props are object that contains an attribute and its corresponding value. Data can be passed from parent component to the children component, but this data is immutable, which means that we cannot modify the props across another component. here is an example
6959+
Props are referred to as "properties". props are passed into react component just like arguments are passed into functions . Props are being specified as attribute just like your html. for example if the name attribute is "name " we assign a value to name. so basically, props are object that contains an attribute and its corresponding value. Data can be passed from parent component to the children component, but this data is immutable, which means that we cannot modify the props across another component. here is an example
69606960
```
69616961
class Introduction extends React.Component {
69626962
render() {

0 commit comments

Comments
 (0)