Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
7c68d0c7
Unverified
Commit
7c68d0c7
authored
May 18, 2020
by
TodorTotev
Committed by
GitHub
May 18, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Removed redundant code from the with-portals example (#13059)
parent
f9b72473
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
7 deletions
+8
-7
Modal.js
examples/with-portals/components/Modal.js
+5
-5
index.js
examples/with-portals/pages/index.js
+3
-2
No files found.
examples/with-portals/components/Modal.js
View file @
7c68d0c7
import
React
,
{
useState
}
from
'react'
import
{
useState
}
from
'react'
import
ClientOnlyPortal
from
'./ClientOnlyPortal'
import
ClientOnlyPortal
from
'./ClientOnlyPortal'
export
default
function
Modal
()
{
export
default
function
Modal
()
{
const
[
open
,
setOpen
]
=
useState
()
const
[
open
,
setOpen
]
=
useState
()
return
(
return
(
<
React
.
Fragment
>
<>
<
button
type
=
"button"
onClick
=
{
event
=>
setOpen
(
true
)}
>
<
button
type
=
"button"
onClick
=
{
()
=>
setOpen
(
true
)}
>
Open
Modal
Open
Modal
<
/button
>
<
/button
>
{
open
&&
(
{
open
&&
(
...
@@ -24,7 +24,7 @@ export default function Modal() {
...
@@ -24,7 +24,7 @@ export default function Modal() {
<
/a
>
<
/a
>
.
.
<
/p
>
<
/p
>
<
button
type
=
"button"
onClick
=
{
event
=>
setOpen
(
false
)}
>
<
button
type
=
"button"
onClick
=
{
()
=>
setOpen
(
false
)}
>
Close
Modal
Close
Modal
<
/button
>
<
/button
>
<
/div
>
<
/div
>
...
@@ -55,6 +55,6 @@ export default function Modal() {
...
@@ -55,6 +55,6 @@ export default function Modal() {
<
/div
>
<
/div
>
<
/ClientOnlyPortal
>
<
/ClientOnlyPortal
>
)}
)}
<
/
React.Fragment
>
<
/
>
)
)
}
}
examples/with-portals/pages/index.js
View file @
7c68d0c7
import
React
from
'react'
import
Modal
from
'../components/Modal'
import
Modal
from
'../components/Modal'
export
default
()
=>
<
Modal
/>
export
default
function
Home
()
{
return
<
Modal
/>
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment