Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22401262
index.jsx
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
index.jsx
View Options
import
'babel-polyfill'
;
import
React
,
{
useState
,
useEffect
}
from
'react'
;
import
ReactDOM
from
'react-dom'
;
import
{
BrowserRouter
as
HashRouter
,
Route
,
Link
}
from
'react-router-dom'
;
const
url
=
'http://localhost:8080/api/v1/specifications'
;
const
Index
=
()
=>
<
h1
>
Admin
panel
<
/h1>;
function
AppRouter
()
{
const
[
collections
,
setCollections
]
=
useState
([]);
useEffect
(()
=>
{
(
async
function
()
{
const
response
=
await
fetch
(
url
,
{
method
:
'GET'
,
headers
:
{
'Content-Type'
:
'application/json'
,
},
});
setCollections
(
await
response
.
json
());
})();
},
[]);
return
(
<
HashRouter
basename
=
"/#"
>
<
div
>
<
nav
>
<
ul
>
{
collections
.
map
(
collection
=>
(
<
li
key
=
{
collection
.
name
}
>
<
Link
to
=
{
`/collection/
${
collection
.
name
}
`
}
>
{
collection
.
name
}
<
/Link>
<
/li>
))}
<
li
>
<
Link
to
=
"/"
>
Home
<
/Link>
<
/li>
<
li
>
<
Link
to
=
"/about/"
>
About
<
/Link>
<
/li>
<
/ul>
<
/nav>
<
Route
path
=
"/"
exact
component
=
{
Index
}
/>
<
/div>
<
/HashRouter>
);
}
console
.
log
(
document
.
getElementById
(
'app'
));
ReactDOM
.
render
(
React
.
createElement
(
AppRouter
),
document
.
getElementById
(
'app'
));
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Fri, Nov 27, 18:18 (1 d, 6 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1213743
Default Alt Text
index.jsx (1 KB)
Attached To
Mode
rSEALPAGE Sealpage
Attached
Detach File
Event Timeline