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
65c0014a
Commit
65c0014a
authored
Apr 23, 2018
by
Tim Neutkens
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add componentDidCatch example
parent
f48b67d5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
2 deletions
+30
-2
.babelrc
examples/.babelrc
+2
-2
package.json
examples/with-componentdidcatch/package.json
+15
-0
_app.js
examples/with-componentdidcatch/pages/_app.js
+9
-0
index.js
examples/with-componentdidcatch/pages/index.js
+4
-0
No files found.
examples/.babelrc
View file @
65c0014a
{
{
"babelrc": false
"presets": ["../babel"]
}
}
\ No newline at end of file
examples/with-componentdidcatch/package.json
0 → 100644
View file @
65c0014a
{
"name"
:
"hello-world"
,
"version"
:
"1.0.0"
,
"scripts"
:
{
"dev"
:
"next"
,
"build"
:
"next build"
,
"start"
:
"next start"
},
"dependencies"
:
{
"next"
:
"6.0.0-canary.6"
,
"react"
:
"^16.0.0"
,
"react-dom"
:
"^16.0.0"
},
"license"
:
"ISC"
}
examples/with-componentdidcatch/pages/_app.js
0 → 100644
View file @
65c0014a
import
App
from
'next/app'
export
default
class
MyApp
extends
App
{
componentDidCatch
(
error
,
errorInfo
)
{
console
.
log
(
'CUSTOM ERROR HANDLING'
,
error
)
// This is needed to render errors correctly in development / production
super
.
componentDidCatch
(
error
,
errorInfo
)
}
}
examples/with-componentdidcatch/pages/index.js
0 → 100644
View file @
65c0014a
export
default
()
=>
{
// Render time error
throw
new
Error
(
'Test'
)
}
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