Skip to content

Commit f097c9e

Browse files
author
muideen
committed
Updated readme
1 parent 4a0cec1 commit f097c9e

File tree

1 file changed

+12
-12
lines changed

1 file changed

+12
-12
lines changed

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -806,7 +806,7 @@ The above code snippets reveals that this.props behavior is different only with
806806
When a component’s props or state change, React decides whether an actual DOM update is necessary by comparing the newly returned element with the previously rendered one. When they are not equal, React will update the DOM. This process is called “reconciliation”.
807807

808808
42. ### How to set state with a dynamic key name?
809-
If you are using ES6 or the Babel transpiler to transform your JSX code thenn you can accomplish this with computed property names
809+
If you are using ES6 or the Babel transpiler to transform your JSX code then you can accomplish this with computed property names
810810
```
811811
handleInputChange : function (event) {
812812
this.setState({ [event.target.id]: event.target.value });
@@ -1071,7 +1071,7 @@ Handling events with React elements has some syntactic differences:
10711071
2. With JSX you pass a function as the event handler, rather than a string.
10721072
---------------
10731073
63. ### What will happen if you use setState in constructor?
1074-
When you use setState(), then apart from assigning to the object state react also re-renders the component and all it's children. You would get error like this:Can only update a mounted or mounting component. So we need to use this.state to initialize variables inside constructor.
1074+
When you use setState(), then apart from assigning to the object state react also re-renders the component and all it's children. You would get error like this: Can only update a mounted or mounting component. So we need to use this.state to initialize variables inside constructor.
10751075

10761076
64. ### What is the impact of indexes as keys?
10771077
Keys should be stable, predictable, and unique so that React can keep track of elements.
@@ -1123,7 +1123,7 @@ class MyComponent extends React.Component {
11231123
11241124
render() {
11251125
return <div>
1126-
this.state.inputVal
1126+
{this.state.inputVal}
11271127
</div>
11281128
}
11291129
}
@@ -1142,7 +1142,7 @@ class MyComponent extends React.Component {
11421142
11431143
render() {
11441144
return <div>
1145-
this.props.inputVal
1145+
{this.props.inputVal}
11461146
</div>
11471147
}
11481148
}
@@ -2062,11 +2062,11 @@ React Router is a powerful routing library built on top of React that helps you
20622062
131. ### How React router is different from history library?
20632063
React Router is a wrapper around the **history** library which handles interaction with the browser's window.history with its browser and hash histories. It also provides memory history which is useful for environments that don't have global history (such as mobile app development (react-native) and unit testing with Node).
20642064

2065-
132.### What are the components of React Router 4 version?
2066-
ReactRouter4 provides below 3 components
2067-
1. <BrowserRouter>
2068-
2. <HashRouter>
2069-
3. <MemoryRouter>
2065+
132. ### What are the components of React Router 4 version?
2066+
React Router 4 provides below 3 components:
2067+
1. \<BrowserRouter>
2068+
2. \<HashRouter>
2069+
3. \<MemoryRouter>
20702070

20712071
The above components will create browser, hash, and memory instances. React Router makes the properties and methods of the history instance associated with your router available through the context, under the router object.
20722072

@@ -2077,7 +2077,7 @@ A history instance has two methods for navigation purpose.
20772077

20782078
If you think of the history as an array of visited locations, push will add a new location to the array and replace will replace the current location in the array with the new one.
20792079

2080-
134. ### How do you programmatically navigate using React router4?
2080+
134. ### How do you programmatically navigate using React Router 4?
20812081
There are three different ways to achieve programmatic routing/navigation within react components.
20822082
1. **Use the withRouter higher-order component:**
20832083
The **withRouter** HOC will inject the history object as a prop of the component. This object provides push and replace methods to avoid the usage of context.
@@ -2131,8 +2131,8 @@ Button.contextTypes = {
21312131
}
21322132
```
21332133

2134-
135. ### How to get query parameters in react-router4?
2135-
The ability to parse query strings was taken out of react-routerV4 because there have been user requests over the years to support different implementation. So the decision has been given to users to choose the implementation they like. The recommended approach is to use query strings library.
2134+
135. ### How to get query parameters in React Router 4?
2135+
The ability to parse query strings was taken out of React Router 4 because there have been user requests over the years to support different implementation. So the decision has been given to users to choose the implementation they like. The recommended approach is to use query strings library.
21362136
```
21372137
const queryString = require('query-string');
21382138
const parsed = queryString.parse(props.location.search);

0 commit comments

Comments
 (0)