forked from mmistakes/minimal-mistakes
/
_hooks_usesref_.html
271 lines (271 loc) · 12.9 KB
/
_hooks_usesref_.html
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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
---
---
<!doctype html>
<html class="default no-js">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>"hooks/useSref" | @uirouter/react</title>
<meta name="description" content="Documentation for @uirouter/react">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="../assets/css/main.css">
</head>
<body>
<header>
<div class="tsd-page-toolbar">
<div class="container">
<div class="table-wrap">
<div class="table-cell" id="tsd-search" data-index="../assets/js/search.json" data-base="..">
<div class="field">
<label for="tsd-search-field" class="tsd-widget search no-caption">Search</label>
<input id="tsd-search-field" type="text" />
</div>
<ul class="results">
<li class="state loading">Preparing search index...</li>
<li class="state failure">The search index is not available</li>
</ul>
<a href="../index.html" class="title">@uirouter/react</a>
</div>
<div class="table-cell" id="tsd-widgets">
<div id="tsd-filter">
<a href="#" class="tsd-widget options no-caption" data-toggle="options">Options</a>
<div class="tsd-filter-group">
<div class="tsd-select" id="tsd-filter-visibility">
<span class="tsd-select-label">All</span>
<ul class="tsd-select-list">
<li data-value="public">Public</li>
<li data-value="protected">Public/Protected</li>
<li data-value="private" class="selected">All</li>
</ul>
</div>
<input type="checkbox" id="tsd-filter-inherited" checked />
<label class="tsd-widget" for="tsd-filter-inherited">Inherited</label>
<input type="checkbox" id="tsd-filter-externals" checked />
<label class="tsd-widget" for="tsd-filter-externals">Externals</label>
</div>
</div>
<a href="#" class="tsd-widget menu no-caption" data-toggle="menu">Menu</a>
</div>
</div>
</div>
</div>
<div class="tsd-page-title">
<div class="container">
<ul class="tsd-breadcrumb">
<li>
<a href="../index.html">@uirouter/react</a>
</li>
<li>
<a href="_hooks_usesref_.html">"hooks/useSref"</a>
</li>
</ul>
<h1>Module "hooks/useSref"</h1>
</div>
</div>
</header>
<div class="container container-main">
<div class="row">
<div class="col-8 col-content">
<section class="tsd-panel tsd-comment">
<div class="tsd-comment tsd-typography">
</div>
</section>
<section class="tsd-panel-group tsd-index-group">
<h2>Index</h2>
<section class="tsd-panel tsd-index-panel">
<div class="tsd-index-content">
<section class="tsd-index-section tsd-is-external">
<h3>Interfaces</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-interface tsd-parent-kind-module tsd-is-external"><a href="../interfaces/_hooks_usesref_.linkprops.html" class="tsd-kind-icon">Link<wbr>Props</a></li>
</ul>
</section>
<section class="tsd-index-section tsd-is-external">
<h3>Functions</h3>
<ul class="tsd-index-list">
<li class="tsd-kind-function tsd-parent-kind-module tsd-is-external"><a href="_hooks_usesref_.html#usesref" class="tsd-kind-icon">use<wbr>Sref</a></li>
</ul>
</section>
</div>
</section>
</section>
<section class="tsd-panel-group tsd-member-group tsd-is-external">
<h2>Functions</h2>
<section class="tsd-panel tsd-member tsd-kind-function tsd-parent-kind-module tsd-is-external">
<a name="usesref" class="tsd-anchor"></a>
<h3>use<wbr>Sref</h3>
<ul class="tsd-signatures tsd-kind-function tsd-parent-kind-module tsd-is-external">
<li class="tsd-signature tsd-kind-icon">use<wbr>Sref<span class="tsd-signature-symbol">(</span>stateName<span class="tsd-signature-symbol">: </span><span class="tsd-signature-type">string</span>, params<span class="tsd-signature-symbol">?: </span><span class="tsd-signature-type">object</span>, options<span class="tsd-signature-symbol">?: </span><a href="../interfaces/_uirouter_core_transition_interface.transitionoptions.html" class="tsd-signature-type">TransitionOptions</a><span class="tsd-signature-symbol">)</span><span class="tsd-signature-symbol">: </span><a href="../interfaces/_hooks_usesref_.linkprops.html" class="tsd-signature-type">LinkProps</a></li>
</ul>
<ul class="tsd-descriptions">
<li class="tsd-description">
<aside class="tsd-sources">
<ul>
<li>Defined in <a href="https://github.com/ui-router/react/blob/27610e86/src/hooks/useSref.ts#L67">src/hooks/useSref.ts:67</a></li>
</ul>
</aside>
<div class="tsd-comment tsd-typography">
<div class="lead">
<p>A hook to create a link to a state.</p>
</div>
<p>This hook returns link (anchor tag) props for a given state reference.
The resulting props can be spread onto an anchor tag.</p>
<p>The props returned from this hook are:</p>
<ul>
<li><code>href</code>: the browser URL of the referenced state</li>
<li><code>onClick</code>: a mouse event handler that will active the referenced state</li>
</ul>
<p>Example:</p>
<pre><code class="language-jsx"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">HomeLink</span>(<span class="hljs-params"></span>) </span>{
<span class="hljs-keyword">const</span> sref = useSref(<span class="hljs-string">'home'</span>);
<span class="hljs-keyword">return</span> <span class="xml"><span class="hljs-tag"><<span class="hljs-name">a</span> {<span class="hljs-attr">...sref</span>}></span>Home<span class="hljs-tag"></<span class="hljs-name">a</span>></span></span>
}</code></pre>
<p>Example:</p>
<pre><code class="language-jsx"><span class="hljs-function"><span class="hljs-keyword">function</span> <span class="hljs-title">UserLink</span>(<span class="hljs-params">{ userId, username }</span>) </span>{
<span class="hljs-keyword">const</span> sref = useSref(<span class="hljs-string">'users.user'</span>, { <span class="hljs-attr">userId</span>: userId });
<span class="hljs-keyword">return</span> <span class="xml"><span class="hljs-tag"><<span class="hljs-name">a</span> {<span class="hljs-attr">...sref</span>}></span>{username}<span class="hljs-tag"></<span class="hljs-name">a</span>></span></span>
}</code></pre>
</div>
<h4 class="tsd-parameters-title">Parameters</h4>
<ul class="tsd-parameters">
<li>
<h5>stateName: <span class="tsd-signature-type">string</span></h5>
<div class="tsd-comment tsd-typography">
<p>The name of the state to link to</p>
</div>
</li>
<li>
<h5><span class="tsd-flag ts-flagDefault value">Default value</span> params: <span class="tsd-signature-type">object</span><span class="tsd-signature-symbol"> = {}</span></h5>
<div class="tsd-comment tsd-typography">
<p>Any parameter values</p>
</div>
</li>
<li>
<h5><span class="tsd-flag ts-flagDefault value">Default value</span> options: <a href="../interfaces/_uirouter_core_transition_interface.transitionoptions.html" class="tsd-signature-type">TransitionOptions</a><span class="tsd-signature-symbol"> = {}</span></h5>
<div class="tsd-comment tsd-typography">
<p>Transition options used when the onClick handler fires.</p>
</div>
</li>
</ul>
<h4 class="tsd-returns-title">Returns <a href="../interfaces/_hooks_usesref_.linkprops.html" class="tsd-signature-type">LinkProps</a></h4>
</li>
</ul>
</section>
</section>
</div>
<div class="col-4 col-menu menu-sticky-wrap menu-highlight">
<nav class="tsd-navigation primary">
<ul>
<li class="label ">
<span></span>
</li>
<li class="current tsd-kind-class tsd-parent-kind-module tsd-is-external">
<a href="../classes/_core_.uirouterreact.html">UIRouter<wbr>React</a>
</li>
<li class="label ">
<span>Services</span>
</li>
<li class="current tsd-kind-class tsd-parent-kind-module tsd-is-external">
<a href="../classes/_uirouter_core_state_stateservice.stateservice.html">State<wbr>Service</a>
</li>
<li class="current tsd-kind-class tsd-parent-kind-module tsd-is-external">
<a href="../classes/_uirouter_core_state_stateregistry.stateregistry.html">State<wbr>Registry</a>
</li>
<li class="current tsd-kind-class tsd-parent-kind-module tsd-is-external">
<a href="../classes/_uirouter_core_transition_transitionservice.transitionservice.html">Transition<wbr>Service</a>
</li>
<li class="current tsd-kind-class tsd-parent-kind-module tsd-is-external">
<a href="../classes/_uirouter_core_url_urlservice.urlservice.html">Url<wbr>Service</a>
</li>
<li class="current tsd-kind-class tsd-parent-kind-module tsd-is-external">
<a href="../classes/_uirouter_core_url_urlconfig.urlconfig.html">Url<wbr>Config</a>
</li>
<li class="current tsd-kind-class tsd-parent-kind-module tsd-is-external">
<a href="../classes/_uirouter_core_url_urlrules.urlrules.html">Url<wbr>Rules</a>
</li>
<li class="label ">
<span>Interfaces</span>
</li>
<li class="current tsd-kind-interface tsd-parent-kind-module tsd-is-external">
<a href="../interfaces/_interface_.reactstatedeclaration.html">React<wbr>State<wbr>Declaration</a>
</li>
<li class="label ">
<span>Components</span>
</li>
<li class="current tsd-kind-class tsd-parent-kind-module tsd-is-external">
<a href="../classes/_uirouter_core_router.uirouter.html">UIRouter</a>
</li>
<li class="current tsd-kind-class tsd-parent-kind-module tsd-has-type-parameter tsd-is-external">
<a href="../classes/_components_uiview_.uiview.html">UIView</a>
</li>
<li class="current tsd-kind-function tsd-parent-kind-module tsd-is-external">
<a href="_components_uisref_.html#uisref">UISref</a>
</li>
<li class="current tsd-kind-function tsd-parent-kind-module tsd-is-external">
<a href="_components_uisrefactive_.html#uisrefactive">UISref<wbr>Active</a>
</li>
<li class="label ">
<span>React <wbr>Hooks</span>
</li>
<li class="current tsd-kind-function tsd-parent-kind-module tsd-is-external">
<a href="_hooks_userouter_.html#userouter">use<wbr>Router</a>
</li>
<li class="current tsd-kind-function tsd-parent-kind-module tsd-is-external">
<a href="_hooks_usesref_.html#usesref">use<wbr>Sref</a>
</li>
<li class="current tsd-kind-function tsd-parent-kind-module tsd-is-external">
<a href="_hooks_usesrefactive_.html#usesrefactive">use<wbr>Sref<wbr>Active</a>
</li>
<li class="current tsd-kind-function tsd-parent-kind-module tsd-is-external">
<a href="_hooks_usesrefactiveexact_.html#usesrefactiveexact">use<wbr>Sref<wbr>Active<wbr>Exact</a>
</li>
<li class="current tsd-kind-function tsd-parent-kind-module tsd-is-external">
<a href="_hooks_usetransitionhook_.html#usetransitionhook">use<wbr>Transition<wbr>Hook</a>
</li>
<li class="current tsd-kind-function tsd-parent-kind-module tsd-is-external">
<a href="_hooks_usecurrentstateandparams_.html#usecurrentstateandparams">use<wbr>Current<wbr>State<wbr>And<wbr>Params</a>
</li>
<li class="current tsd-kind-function tsd-parent-kind-module tsd-is-external">
<a href="_hooks_useonstatechanged_.html#useonstatechanged">use<wbr>OnState<wbr>Changed</a>
</li>
<li class="current tsd-kind-function tsd-parent-kind-module tsd-is-external">
<a href="_hooks_useisactive_.html#useisactive">use<wbr>IsActive</a>
</li>
<li class="label ">
<span>Other</span>
</li>
<li class="current tsd-kind-class tsd-parent-kind-module tsd-is-external">
<a href="../classes/_uirouter_core_transition_transition.transition.html">Transition</a>
</li>
<li class="current tsd-kind-class tsd-parent-kind-module tsd-is-external">
<a href="../classes/_uirouter_core_common_trace.trace.html">Trace</a>
</li>
</ul>
</nav>
<nav class="tsd-navigation secondary menu-sticky">
<ul class="before-current">
<li class=" tsd-kind-interface tsd-parent-kind-module tsd-is-external">
<a href="../interfaces/_hooks_usesref_.linkprops.html" class="tsd-kind-icon">Link<wbr>Props</a>
</li>
<li class=" tsd-kind-function tsd-parent-kind-module tsd-is-external">
<a href="_hooks_usesref_.html#usesref" class="tsd-kind-icon">use<wbr>Sref</a>
</li>
</ul>
</nav>
</div>
</div>
</div>
<footer class="with-border-bottom">
<div class="container">
<h2>Legend</h2>
<div class="tsd-legend-group">
</div>
</div>
</footer>
<div class="container tsd-generator">
<p>Generated using <a href="https://typedoc.org/" target="_blank">TypeDoc</a></p>
</div>
<div class="overlay"></div>
<script src="../assets/js/main.js"></script>
</body>
</html>