-
Notifications
You must be signed in to change notification settings - Fork 2
/
Route.hx
64 lines (53 loc) · 1.76 KB
/
Route.hx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
package react.router;
import haxe.extern.EitherType;
import history.History;
import history.Location;
import react.ReactComponent;
#if (!react_next && (react < "2.0"))
private typedef ReactType = react.React.CreateElementType;
#else
import react.ReactType;
#end
typedef RouteRenderProps = {
@:optional var match:RouterMatch;
@:optional var location:Location;
@:optional var history:History;
}
typedef RouteMatchProps = {
@:optional var path:String;
@:optional var exact:Bool;
@:optional var strict:Bool;
@:optional var sensitive:Bool;
}
typedef ChildrenRouteProps = {
var match:Null<RouterMatch>;
var location:Location;
var history:History;
}
typedef RouteComponentProps = {
> RouteRenderProps,
> RouteMatchProps,
@:optional var component:ReactType;
#if react_next
@:optional var render:RouteRenderProps->ReactFragment;
@:optional var children:EitherType<ChildrenRouteProps->ReactFragment, ReactFragment>;
#else
@:optional var render:RouteRenderProps->ReactElement;
@:optional var children:EitherType<ChildrenRouteProps->ReactFragment, ReactElement>;
#end
}
/**
The Route component is perhaps the most important component in React Router
to understand and learn to use well. Its most basic responsibility is to
render some UI when a location matches the route’s path.
There are 3 ways to render something with a <Route>:
<Route component>
<Route render>
<Route children>
Each is useful in different circumstances. You should use only one of these
props on a given <Route>. See their explanations below to understand why you
have 3 options. Most of the time you’ll use component.
See https://reacttraining.com/react-router/web/api/Route
*/
@:jsRequire('react-router', 'Route')
extern class Route extends ReactComponentOfProps<RouteComponentProps> {}