Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
CoCo_Code_Op2
next.js
提交
dd264f58
N
next.js
项目概览
CoCo_Code_Op2
/
next.js
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
N
next.js
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
dd264f58
编写于
5月 18, 2020
作者:
J
jmgr2996
提交者:
GitHub
5月 18, 2020
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
chore: Remove redundant imports in several examples (#13030)
上级
97a61a18
变更
47
隐藏空白更改
内联
并排
Showing
47 changed file
with
19 addition
and
62 deletion
+19
-62
examples/auth0/pages/about.js
examples/auth0/pages/about.js
+0
-2
examples/auth0/pages/index.js
examples/auth0/pages/index.js
+0
-2
examples/auth0/pages/profile.js
examples/auth0/pages/profile.js
+0
-2
examples/with-apollo-and-redux/components/Clock.js
examples/with-apollo-and-redux/components/Clock.js
+0
-1
examples/with-apollo-and-redux/components/Counter.js
examples/with-apollo-and-redux/components/Counter.js
+0
-1
examples/with-apollo-and-redux/components/ErrorMessage.js
examples/with-apollo-and-redux/components/ErrorMessage.js
+0
-1
examples/with-apollo-and-redux/components/Layout.js
examples/with-apollo-and-redux/components/Layout.js
+0
-1
examples/with-apollo-and-redux/components/PostUpvoter.js
examples/with-apollo-and-redux/components/PostUpvoter.js
+0
-1
examples/with-apollo-and-redux/lib/apollo.js
examples/with-apollo-and-redux/lib/apollo.js
+0
-1
examples/with-apollo-and-redux/lib/redux.js
examples/with-apollo-and-redux/lib/redux.js
+0
-1
examples/with-apollo-and-redux/pages/index.js
examples/with-apollo-and-redux/pages/index.js
+0
-1
examples/with-apollo-and-redux/pages/redux.js
examples/with-apollo-and-redux/pages/redux.js
+0
-1
examples/with-apollo/components/PostUpvoter.js
examples/with-apollo/components/PostUpvoter.js
+0
-1
examples/with-apollo/lib/apollo.js
examples/with-apollo/lib/apollo.js
+0
-1
examples/with-context-api/components/Counter.js
examples/with-context-api/components/Counter.js
+3
-3
examples/with-context-api/pages/about.js
examples/with-context-api/pages/about.js
+0
-1
examples/with-context-api/pages/index.js
examples/with-context-api/pages/index.js
+0
-1
examples/with-docker/pages/index.js
examples/with-docker/pages/index.js
+0
-2
examples/with-emotion/pages/_app.js
examples/with-emotion/pages/_app.js
+0
-1
examples/with-redux-observable/components/CharacterInfo.js
examples/with-redux-observable/components/CharacterInfo.js
+0
-1
examples/with-redux-observable/pages/_app.js
examples/with-redux-observable/pages/_app.js
+0
-1
examples/with-redux-observable/pages/index.js
examples/with-redux-observable/pages/index.js
+2
-2
examples/with-redux-observable/pages/other.js
examples/with-redux-observable/pages/other.js
+0
-1
examples/with-redux-persist/components/counter.js
examples/with-redux-persist/components/counter.js
+1
-1
examples/with-redux-persist/components/data-list.js
examples/with-redux-persist/components/data-list.js
+1
-1
examples/with-redux-persist/lib/with-redux-store.js
examples/with-redux-persist/lib/with-redux-store.js
+2
-2
examples/with-redux-persist/pages/_app.js
examples/with-redux-persist/pages/_app.js
+0
-1
examples/with-redux-persist/pages/index.js
examples/with-redux-persist/pages/index.js
+2
-2
examples/with-redux-saga/components/clock.js
examples/with-redux-saga/components/clock.js
+0
-2
examples/with-redux-saga/components/counter.js
examples/with-redux-saga/components/counter.js
+1
-1
examples/with-redux-saga/pages/_app.js
examples/with-redux-saga/pages/_app.js
+0
-1
examples/with-redux-saga/pages/index.js
examples/with-redux-saga/pages/index.js
+2
-2
examples/with-redux-saga/pages/other.js
examples/with-redux-saga/pages/other.js
+2
-2
examples/with-redux-thunk/components/clock.js
examples/with-redux-thunk/components/clock.js
+0
-2
examples/with-redux-thunk/components/counter.js
examples/with-redux-thunk/components/counter.js
+0
-1
examples/with-redux-thunk/components/examples.js
examples/with-redux-thunk/components/examples.js
+0
-1
examples/with-redux-thunk/lib/with-redux-store.js
examples/with-redux-thunk/lib/with-redux-store.js
+2
-2
examples/with-redux-thunk/pages/_app.js
examples/with-redux-thunk/pages/_app.js
+0
-1
examples/with-redux-thunk/pages/index.js
examples/with-redux-thunk/pages/index.js
+1
-1
examples/with-redux-thunk/pages/show-redux-state.js
examples/with-redux-thunk/pages/show-redux-state.js
+0
-1
examples/with-redux-toolkit/components/clock.js
examples/with-redux-toolkit/components/clock.js
+0
-1
examples/with-redux-toolkit/components/counter.js
examples/with-redux-toolkit/components/counter.js
+0
-1
examples/with-redux-toolkit/pages/_app.js
examples/with-redux-toolkit/pages/_app.js
+0
-1
examples/with-redux-toolkit/pages/index.js
examples/with-redux-toolkit/pages/index.js
+0
-1
examples/with-styled-components/README.md
examples/with-styled-components/README.md
+0
-2
examples/with-styled-components/pages/_app.js
examples/with-styled-components/pages/_app.js
+0
-1
examples/with-styled-components/pages/index.js
examples/with-styled-components/pages/index.js
+0
-1
未找到文件。
examples/auth0/pages/about.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
Layout
from
'
../components/layout
'
import
{
useFetchUser
}
from
'
../lib/user
'
...
...
examples/auth0/pages/index.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
Layout
from
'
../components/layout
'
import
{
useFetchUser
}
from
'
../lib/user
'
...
...
examples/auth0/pages/profile.js
浏览文件 @
dd264f58
import
React
from
'
react
'
// This import is only needed when checking authentication status directly from getInitialProps
// import auth0 from '../lib/auth0'
import
{
useFetchUser
}
from
'
../lib/user
'
...
...
examples/with-apollo-and-redux/components/Clock.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
{
useSelector
,
shallowEqual
}
from
'
react-redux
'
const
useClock
=
()
=>
{
...
...
examples/with-apollo-and-redux/components/Counter.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
{
useSelector
,
useDispatch
}
from
'
react-redux
'
const
useCounter
=
()
=>
{
...
...
examples/with-apollo-and-redux/components/ErrorMessage.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
PropTypes
from
'
prop-types
'
const
ErrorMessage
=
({
message
})
=>
(
...
...
examples/with-apollo-and-redux/components/Layout.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
Nav
from
'
./Nav
'
import
PropTypes
from
'
prop-types
'
...
...
examples/with-apollo-and-redux/components/PostUpvoter.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
{
useMutation
}
from
'
@apollo/react-hooks
'
import
gql
from
'
graphql-tag
'
import
PropTypes
from
'
prop-types
'
...
...
examples/with-apollo-and-redux/lib/apollo.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
Head
from
'
next/head
'
import
{
ApolloProvider
}
from
'
@apollo/react-hooks
'
import
{
ApolloClient
}
from
'
apollo-client
'
...
...
examples/with-apollo-and-redux/lib/redux.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
{
Provider
}
from
'
react-redux
'
import
{
initializeStore
}
from
'
../store
'
import
App
from
'
next/app
'
...
...
examples/with-apollo-and-redux/pages/index.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
{
useDispatch
}
from
'
react-redux
'
import
{
withRedux
}
from
'
../lib/redux
'
import
{
compose
}
from
'
redux
'
...
...
examples/with-apollo-and-redux/pages/redux.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
{
useDispatch
}
from
'
react-redux
'
import
{
withRedux
}
from
'
../lib/redux
'
import
useInterval
from
'
../lib/useInterval
'
...
...
examples/with-apollo/components/PostUpvoter.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
{
useMutation
}
from
'
@apollo/react-hooks
'
import
gql
from
'
graphql-tag
'
...
...
examples/with-apollo/lib/apollo.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
App
from
'
next/app
'
import
Head
from
'
next/head
'
import
{
ApolloProvider
}
from
'
@apollo/react-hooks
'
...
...
examples/with-context-api/components/Counter.js
浏览文件 @
dd264f58
import
React
,
{
useReducer
,
us
eContext
}
from
'
react
'
import
{
useReducer
,
useContext
,
creat
eContext
}
from
'
react
'
const
CounterStateContext
=
React
.
createContext
()
const
CounterDispatchContext
=
React
.
createContext
()
const
CounterStateContext
=
createContext
()
const
CounterDispatchContext
=
createContext
()
const
reducer
=
(
state
,
action
)
=>
{
switch
(
action
.
type
)
{
...
...
examples/with-context-api/pages/about.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
Link
from
'
next/link
'
import
{
useCount
,
useDispatchCount
}
from
'
../components/Counter
'
...
...
examples/with-context-api/pages/index.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
Link
from
'
next/link
'
import
{
useCount
,
useDispatchCount
}
from
'
../components/Counter
'
...
...
examples/with-docker/pages/index.js
浏览文件 @
dd264f58
import
React
from
'
react
'
export
default
()
=>
{
return
<
h1
>
Hello
World
!<
/h1
>
}
examples/with-emotion/pages/_app.js
浏览文件 @
dd264f58
import
*
as
React
from
'
react
'
import
NextApp
from
'
next/app
'
import
{
CacheProvider
}
from
'
@emotion/core
'
...
...
examples/with-redux-observable/components/CharacterInfo.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
{
connect
}
from
'
react-redux
'
const
CharacterInfo
=
({
...
...
examples/with-redux-observable/pages/_app.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
{
Provider
}
from
'
react-redux
'
import
App
from
'
next/app
'
import
withRedux
from
'
next-redux-wrapper
'
...
...
examples/with-redux-observable/pages/index.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
{
Component
}
from
'
react
'
import
Link
from
'
next/link
'
import
{
of
,
Subject
}
from
'
rxjs
'
import
{
StateObservable
}
from
'
redux-observable
'
...
...
@@ -7,7 +7,7 @@ import CharacterInfo from '../components/CharacterInfo'
import
{
rootEpic
}
from
'
../redux/epics
'
import
*
as
actions
from
'
../redux/actions
'
class
Counter
extends
React
.
Component
{
class
Counter
extends
Component
{
static
async
getInitialProps
({
store
,
isServer
})
{
const
state$
=
new
StateObservable
(
new
Subject
(),
store
.
getState
())
const
resultAction
=
await
rootEpic
(
...
...
examples/with-redux-observable/pages/other.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
Link
from
'
next/link
'
const
OtherPage
=
()
=>
(
...
...
examples/with-redux-persist/components/counter.js
浏览文件 @
dd264f58
import
React
,
{
Component
}
from
'
react
'
import
{
Component
}
from
'
react
'
import
{
connect
}
from
'
react-redux
'
import
{
bindActionCreators
}
from
'
redux
'
import
{
incrementCount
,
decrementCount
,
resetCount
}
from
'
../store
'
...
...
examples/with-redux-persist/components/data-list.js
浏览文件 @
dd264f58
import
React
,
{
Component
}
from
'
react
'
import
{
Component
}
from
'
react
'
import
{
connect
}
from
'
react-redux
'
import
{
bindActionCreators
}
from
'
redux
'
import
{
loadExampleData
,
loadingExampleDataFailure
}
from
'
../store
'
...
...
examples/with-redux-persist/lib/with-redux-store.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
{
Component
}
from
'
react
'
import
{
initializeStore
}
from
'
../store
'
const
isServer
=
typeof
window
===
'
undefined
'
...
...
@@ -18,7 +18,7 @@ function getOrCreateStore(initialState) {
}
export
default
App
=>
{
return
class
AppWithRedux
extends
React
.
Component
{
return
class
AppWithRedux
extends
Component
{
static
async
getInitialProps
(
appContext
)
{
// Get or Create the store with `undefined` as initialState
// This allows you to set a custom default initialState
...
...
examples/with-redux-persist/pages/_app.js
浏览文件 @
dd264f58
import
App
from
'
next/app
'
import
React
from
'
react
'
import
withReduxStore
from
'
../lib/with-redux-store
'
import
{
Provider
}
from
'
react-redux
'
import
{
persistStore
}
from
'
redux-persist
'
...
...
examples/with-redux-persist/pages/index.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
{
Component
}
from
'
react
'
import
{
connect
}
from
'
react-redux
'
import
{
startClock
,
serverRenderClock
}
from
'
../store
'
import
Examples
from
'
../components/examples
'
class
Index
extends
React
.
Component
{
class
Index
extends
Component
{
static
getInitialProps
({
reduxStore
,
req
})
{
const
isServer
=
!!
req
// DISPATCH ACTIONS HERE ONLY WITH `reduxStore.dispatch`
...
...
examples/with-redux-saga/components/clock.js
浏览文件 @
dd264f58
import
React
from
'
react
'
const
pad
=
n
=>
(
n
<
10
?
`0
${
n
}
`
:
n
)
const
format
=
t
=>
{
...
...
examples/with-redux-saga/components/counter.js
浏览文件 @
dd264f58
import
React
,
{
Component
}
from
'
react
'
import
{
Component
}
from
'
react
'
import
{
connect
}
from
'
react-redux
'
import
{
increment
,
decrement
,
reset
}
from
'
../actions
'
...
...
examples/with-redux-saga/pages/_app.js
浏览文件 @
dd264f58
import
App
from
'
next/app
'
import
React
from
'
react
'
import
{
Provider
}
from
'
react-redux
'
import
withRedux
from
'
next-redux-wrapper
'
import
withReduxSaga
from
'
next-redux-saga
'
...
...
examples/with-redux-saga/pages/index.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
{
Component
}
from
'
react
'
import
{
connect
}
from
'
react-redux
'
import
{
loadData
,
startClock
,
tickClock
}
from
'
../actions
'
import
Page
from
'
../components/page
'
class
Index
extends
React
.
Component
{
class
Index
extends
Component
{
static
async
getInitialProps
(
props
)
{
const
{
store
,
isServer
}
=
props
.
ctx
store
.
dispatch
(
tickClock
(
isServer
))
...
...
examples/with-redux-saga/pages/other.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
{
Component
}
from
'
react
'
import
{
connect
}
from
'
react-redux
'
import
{
startClock
,
tickClock
}
from
'
../actions
'
import
Page
from
'
../components/page
'
class
Other
extends
React
.
Component
{
class
Other
extends
Component
{
static
async
getInitialProps
(
props
)
{
const
{
store
,
isServer
}
=
props
.
ctx
store
.
dispatch
(
tickClock
(
isServer
))
...
...
examples/with-redux-thunk/components/clock.js
浏览文件 @
dd264f58
import
React
from
'
react
'
const
pad
=
n
=>
(
n
<
10
?
`0
${
n
}
`
:
n
)
const
format
=
t
=>
...
...
examples/with-redux-thunk/components/counter.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
{
useSelector
,
useDispatch
}
from
'
react-redux
'
import
{
incrementCount
,
decrementCount
,
resetCount
}
from
'
../actions
'
...
...
examples/with-redux-thunk/components/examples.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
{
useSelector
}
from
'
react-redux
'
import
Clock
from
'
./clock
'
import
Counter
from
'
./counter
'
...
...
examples/with-redux-thunk/lib/with-redux-store.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
{
Component
}
from
'
react
'
import
initializeStore
from
'
../store
'
const
__NEXT_REDUX_STORE__
=
'
__NEXT_REDUX_STORE__
'
...
...
@@ -17,7 +17,7 @@ function getOrCreateStore(initialState) {
}
export
default
App
=>
{
return
class
AppWithRedux
extends
React
.
Component
{
return
class
AppWithRedux
extends
Component
{
static
async
getInitialProps
(
appContext
)
{
// Get or Create the store with `undefined` as initialState
// This allows you to set a custom default initialState
...
...
examples/with-redux-thunk/pages/_app.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
{
Provider
}
from
'
react-redux
'
import
App
from
'
next/app
'
import
withReduxStore
from
'
../lib/with-redux-store
'
...
...
examples/with-redux-thunk/pages/index.js
浏览文件 @
dd264f58
import
React
,
{
PureComponent
}
from
'
react
'
import
{
PureComponent
}
from
'
react
'
import
{
connect
}
from
'
react-redux
'
import
Link
from
'
next/link
'
import
{
startClock
,
serverRenderClock
}
from
'
../actions
'
...
...
examples/with-redux-thunk/pages/show-redux-state.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
{
connect
}
from
'
react-redux
'
import
Link
from
'
next/link
'
...
...
examples/with-redux-toolkit/components/clock.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
{
useSelector
,
shallowEqual
}
from
'
react-redux
'
const
useClock
=
()
=>
{
...
...
examples/with-redux-toolkit/components/counter.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
{
createAction
}
from
'
@reduxjs/toolkit
'
import
{
useSelector
,
useDispatch
}
from
'
react-redux
'
...
...
examples/with-redux-toolkit/pages/_app.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
{
Provider
}
from
'
react-redux
'
import
{
store
}
from
'
../store
'
...
...
examples/with-redux-toolkit/pages/index.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
{
createAction
}
from
'
@reduxjs/toolkit
'
import
{
connect
}
from
'
react-redux
'
import
useInterval
from
'
../lib/useInterval
'
...
...
examples/with-styled-components/README.md
浏览文件 @
dd264f58
...
...
@@ -58,7 +58,6 @@ When wrapping a [Link](https://nextjs.org/docs/api-reference/next/link) from `ne
**components/StyledLink.js**
```
javascript
import
React
from
'
react
'
import
Link
from
'
next/link
'
import
styled
from
'
styled-components
'
...
...
@@ -88,7 +87,6 @@ export default styled(StyledLink)`
**pages/index.js**
```
javascript
import
React
from
'
react
'
import
StyledLink
from
'
../components/StyledLink
'
export
default
()
=>
(
...
...
examples/with-styled-components/pages/_app.js
浏览文件 @
dd264f58
import
App
from
'
next/app
'
import
React
from
'
react
'
import
{
ThemeProvider
}
from
'
styled-components
'
const
theme
=
{
...
...
examples/with-styled-components/pages/index.js
浏览文件 @
dd264f58
import
React
from
'
react
'
import
styled
from
'
styled-components
'
const
Title
=
styled
.
h1
`
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录