Skip to content

Commit 8cad408

Browse files
committed
chore: correct types after @xram review
1 parent 5d66625 commit 8cad408

File tree

4 files changed

+8
-10
lines changed

4 files changed

+8
-10
lines changed

docs/route.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ So, if you wanted to store the state of the route in Redux, there was no good wa
2727
state of the route in Redux, so you cannot use it if you use any other state container, say MobX.
2828

2929
Libreact is completely orthogonal to where you store the *current route*, all you have to do is provide the current route to the `<Router>`
30-
coponent using the `route` prop.
30+
component using the `route` prop.
3131

3232
```jsx
3333
<Router route={currentRoute}>
@@ -73,7 +73,7 @@ own routing logic.
7373

7474
### `<Router>`
7575

76-
`Router` is a root component that provides routing to your application. I should be placed above all other components
76+
`Router` is a root component that provides routing to your application. It should be placed above all other components
7777
that use routing. It uses React's context [`Provider`](./context.md#provider) component to provide route information to
7878
its children.
7979

@@ -140,7 +140,7 @@ interface TRouteMatchResult {
140140
with the following properties:
141141
- `length` - required, number of characters to truncate from the start of the route, for the inner routes, basically this should be
142142
equal to the length of the matched fragment of the path.
143-
- `matches` - optionsl, array of matches returned by `String.prototype.match()` function.
143+
- `matches` - optional, array of matches returned by `String.prototype.match()` function.
144144

145145

146146
### `go()`

src/LocationSensor/index.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,6 @@ const patchHistoryMethod = (method) => {
99
const event = new Event(method.toLowerCase());
1010

1111
(event as any).state = state;
12-
// (event as any).title = title;
13-
// (event as any).url = url;
1412

1513
window.dispatchEvent(event);
1614

@@ -79,7 +77,7 @@ export class LocationSensor extends Component<ILocationSensorProps, ILocationSen
7977
};
8078

8179
onReplacestate = (e) => {
82-
this.onChange('replacestaet');
80+
this.onChange('replacestate');
8381
};
8482

8583
onChange = (trigger: string) => {

src/route/__story__/StoryRouteExample2.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const Topics = (props) => {
5959
</ul>
6060

6161
<Route comp={Topic}/>
62-
<Route exact path={match.url} render={() => (
62+
<Route exact match={match} children={() => (
6363
<h3>Please select a topic.</h3>
6464
)}/>
6565
</div>

src/route/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ export class Router extends Component<IRouteProviderProps, any> {
2626
value: {
2727
route,
2828
onMatch: this.onMatch,
29-
getMathces: () => this.matches,
29+
getMatches: () => this.matches,
3030
parent: this.props.parent
3131
}
3232
}, Array.isArray(children) ? h('div', null, children) : children);
@@ -110,10 +110,10 @@ export class Route extends Component<IRouteMatch, any> {
110110
}
111111

112112
render () {
113-
return h(Consumer, {name: ns(`route/${this.props.ns}`)}, ({route, onMatch, getMathces, parent}) => {
113+
return h(Consumer, {name: ns(`route/${this.props.ns}`)}, ({route, onMatch, getMatches, parent}) => {
114114
const {children, match, preserve} = this.props;
115115

116-
if (getMathces() <= this.props.cnt) {
116+
if (getMatches() <= this.props.cnt) {
117117
const matchResult = this.matcher()(route);
118118

119119
if (matchResult) {

0 commit comments

Comments
 (0)