未验证 提交 dd264f58 编写于 作者: J jmgr2996 提交者: GitHub

chore: Remove redundant imports in several examples (#13030)

上级 97a61a18
import React from 'react'
import Layout from '../components/layout'
import { useFetchUser } from '../lib/user'
......
import React from 'react'
import Layout from '../components/layout'
import { useFetchUser } from '../lib/user'
......
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'
......
import React from 'react'
import { useSelector, shallowEqual } from 'react-redux'
const useClock = () => {
......
import React from 'react'
import { useSelector, useDispatch } from 'react-redux'
const useCounter = () => {
......
import React from 'react'
import PropTypes from 'prop-types'
const ErrorMessage = ({ message }) => (
......
import React from 'react'
import Nav from './Nav'
import PropTypes from 'prop-types'
......
import React from 'react'
import { useMutation } from '@apollo/react-hooks'
import gql from 'graphql-tag'
import PropTypes from 'prop-types'
......
import React from 'react'
import Head from 'next/head'
import { ApolloProvider } from '@apollo/react-hooks'
import { ApolloClient } from 'apollo-client'
......
import React from 'react'
import { Provider } from 'react-redux'
import { initializeStore } from '../store'
import App from 'next/app'
......
import React from 'react'
import { useDispatch } from 'react-redux'
import { withRedux } from '../lib/redux'
import { compose } from 'redux'
......
import React from 'react'
import { useDispatch } from 'react-redux'
import { withRedux } from '../lib/redux'
import useInterval from '../lib/useInterval'
......
import React from 'react'
import { useMutation } from '@apollo/react-hooks'
import gql from 'graphql-tag'
......
import React from 'react'
import App from 'next/app'
import Head from 'next/head'
import { ApolloProvider } from '@apollo/react-hooks'
......
import React, { useReducer, useContext } from 'react'
import { useReducer, useContext, createContext } from 'react'
const CounterStateContext = React.createContext()
const CounterDispatchContext = React.createContext()
const CounterStateContext = createContext()
const CounterDispatchContext = createContext()
const reducer = (state, action) => {
switch (action.type) {
......
import React from 'react'
import Link from 'next/link'
import { useCount, useDispatchCount } from '../components/Counter'
......
import React from 'react'
import Link from 'next/link'
import { useCount, useDispatchCount } from '../components/Counter'
......
import React from 'react'
export default () => {
return <h1>Hello World!</h1>
}
import * as React from 'react'
import NextApp from 'next/app'
import { CacheProvider } from '@emotion/core'
......
import React from 'react'
import { connect } from 'react-redux'
const CharacterInfo = ({
......
import React from 'react'
import { Provider } from 'react-redux'
import App from 'next/app'
import withRedux from 'next-redux-wrapper'
......
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(
......
import React from 'react'
import Link from 'next/link'
const OtherPage = () => (
......
import React, { Component } from 'react'
import { Component } from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { incrementCount, decrementCount, resetCount } from '../store'
......
import React, { Component } from 'react'
import { Component } from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { loadExampleData, loadingExampleDataFailure } from '../store'
......
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
......
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'
......
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`
......
import React from 'react'
const pad = n => (n < 10 ? `0${n}` : n)
const format = t => {
......
import React, { Component } from 'react'
import { Component } from 'react'
import { connect } from 'react-redux'
import { increment, decrement, reset } from '../actions'
......
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'
......
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))
......
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))
......
import React from 'react'
const pad = n => (n < 10 ? `0${n}` : n)
const format = t =>
......
import React from 'react'
import { useSelector, useDispatch } from 'react-redux'
import { incrementCount, decrementCount, resetCount } from '../actions'
......
import React from 'react'
import { useSelector } from 'react-redux'
import Clock from './clock'
import Counter from './counter'
......
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
......
import React from 'react'
import { Provider } from 'react-redux'
import App from 'next/app'
import withReduxStore from '../lib/with-redux-store'
......
import React, { PureComponent } from 'react'
import { PureComponent } from 'react'
import { connect } from 'react-redux'
import Link from 'next/link'
import { startClock, serverRenderClock } from '../actions'
......
import React from 'react'
import { connect } from 'react-redux'
import Link from 'next/link'
......
import React from 'react'
import { useSelector, shallowEqual } from 'react-redux'
const useClock = () => {
......
import React from 'react'
import { createAction } from '@reduxjs/toolkit'
import { useSelector, useDispatch } from 'react-redux'
......
import React from 'react'
import { Provider } from 'react-redux'
import { store } from '../store'
......
import React from 'react'
import { createAction } from '@reduxjs/toolkit'
import { connect } from 'react-redux'
import useInterval from '../lib/useInterval'
......
......@@ -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 () => (
......
import App from 'next/app'
import React from 'react'
import { ThemeProvider } from 'styled-components'
const theme = {
......
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.
先完成此消息的编辑!
想要评论请 注册