You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12-12Lines changed: 12 additions & 12 deletions
Original file line number
Diff line number
Diff line change
@@ -806,7 +806,7 @@ The above code snippets reveals that this.props behavior is different only with
806
806
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”.
807
807
808
808
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
@@ -1071,7 +1071,7 @@ Handling events with React elements has some syntactic differences:
1071
1071
2. With JSX you pass a function as the event handler, rather than a string.
1072
1072
---------------
1073
1073
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.
1075
1075
1076
1076
64.### What is the impact of indexes as keys?
1077
1077
Keys should be stable, predictable, and unique so that React can keep track of elements.
@@ -1123,7 +1123,7 @@ class MyComponent extends React.Component {
1123
1123
1124
1124
render() {
1125
1125
return <div>
1126
-
this.state.inputVal
1126
+
{this.state.inputVal}
1127
1127
</div>
1128
1128
}
1129
1129
}
@@ -1142,7 +1142,7 @@ class MyComponent extends React.Component {
1142
1142
1143
1143
render() {
1144
1144
return <div>
1145
-
this.props.inputVal
1145
+
{this.props.inputVal}
1146
1146
</div>
1147
1147
}
1148
1148
}
@@ -2062,11 +2062,11 @@ React Router is a powerful routing library built on top of React that helps you
2062
2062
131.### How React router is different from history library?
2063
2063
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).
2064
2064
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>
2070
2070
2071
2071
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.
2072
2072
@@ -2077,7 +2077,7 @@ A history instance has two methods for navigation purpose.
2077
2077
2078
2078
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.
2079
2079
2080
-
134.### How do you programmatically navigate using React router4?
2080
+
134.### How do you programmatically navigate using React Router 4?
2081
2081
There are three different ways to achieve programmatic routing/navigation within react components.
2082
2082
1.**Use the withRouter higher-order component:**
2083
2083
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 = {
2131
2131
}
2132
2132
```
2133
2133
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.
0 commit comments