Skip to content

Commit

Permalink
chore: Remove redundant imports in several examples (vercel#13030)
Browse files Browse the repository at this point in the history
  • Loading branch information
teo-garcia authored and chibicode committed May 21, 2020
1 parent d2ebd33 commit b973c14
Show file tree
Hide file tree
Showing 47 changed files with 19 additions and 62 deletions.
2 changes: 0 additions & 2 deletions examples/auth0/pages/about.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react'

import Layout from '../components/layout'
import { useFetchUser } from '../lib/user'

Expand Down
2 changes: 0 additions & 2 deletions examples/auth0/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react'

import Layout from '../components/layout'
import { useFetchUser } from '../lib/user'

Expand Down
2 changes: 0 additions & 2 deletions examples/auth0/pages/profile.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
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'
Expand Down
1 change: 0 additions & 1 deletion examples/with-apollo-and-redux/components/Clock.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { useSelector, shallowEqual } from 'react-redux'

const useClock = () => {
Expand Down
1 change: 0 additions & 1 deletion examples/with-apollo-and-redux/components/Counter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { useSelector, useDispatch } from 'react-redux'

const useCounter = () => {
Expand Down
1 change: 0 additions & 1 deletion examples/with-apollo-and-redux/components/ErrorMessage.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import PropTypes from 'prop-types'

const ErrorMessage = ({ message }) => (
Expand Down
1 change: 0 additions & 1 deletion examples/with-apollo-and-redux/components/Layout.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import Nav from './Nav'
import PropTypes from 'prop-types'

Expand Down
1 change: 0 additions & 1 deletion examples/with-apollo-and-redux/components/PostUpvoter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { useMutation } from '@apollo/react-hooks'
import gql from 'graphql-tag'
import PropTypes from 'prop-types'
Expand Down
1 change: 0 additions & 1 deletion examples/with-apollo-and-redux/lib/apollo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import Head from 'next/head'
import { ApolloProvider } from '@apollo/react-hooks'
import { ApolloClient } from 'apollo-client'
Expand Down
1 change: 0 additions & 1 deletion examples/with-apollo-and-redux/lib/redux.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { Provider } from 'react-redux'
import { initializeStore } from '../store'
import App from 'next/app'
Expand Down
1 change: 0 additions & 1 deletion examples/with-apollo-and-redux/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { useDispatch } from 'react-redux'
import { withRedux } from '../lib/redux'
import { compose } from 'redux'
Expand Down
1 change: 0 additions & 1 deletion examples/with-apollo-and-redux/pages/redux.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { useDispatch } from 'react-redux'
import { withRedux } from '../lib/redux'
import useInterval from '../lib/useInterval'
Expand Down
1 change: 0 additions & 1 deletion examples/with-apollo/components/PostUpvoter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { useMutation } from '@apollo/react-hooks'
import gql from 'graphql-tag'

Expand Down
1 change: 0 additions & 1 deletion examples/with-apollo/lib/apollo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import App from 'next/app'
import Head from 'next/head'
import { ApolloProvider } from '@apollo/react-hooks'
Expand Down
6 changes: 3 additions & 3 deletions examples/with-context-api/components/Counter.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
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) {
Expand Down
1 change: 0 additions & 1 deletion examples/with-context-api/pages/about.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import Link from 'next/link'
import { useCount, useDispatchCount } from '../components/Counter'

Expand Down
1 change: 0 additions & 1 deletion examples/with-context-api/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import Link from 'next/link'
import { useCount, useDispatchCount } from '../components/Counter'

Expand Down
2 changes: 0 additions & 2 deletions examples/with-docker/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react'

export default () => {
return <h1>Hello World!</h1>
}
1 change: 0 additions & 1 deletion examples/with-emotion/pages/_app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import * as React from 'react'
import NextApp from 'next/app'
import { CacheProvider } from '@emotion/core'

Expand Down
1 change: 0 additions & 1 deletion examples/with-redux-observable/components/CharacterInfo.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { connect } from 'react-redux'

const CharacterInfo = ({
Expand Down
1 change: 0 additions & 1 deletion examples/with-redux-observable/pages/_app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { Provider } from 'react-redux'
import App from 'next/app'
import withRedux from 'next-redux-wrapper'
Expand Down
4 changes: 2 additions & 2 deletions examples/with-redux-observable/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import { Component } from 'react'
import Link from 'next/link'
import { of, Subject } from 'rxjs'
import { StateObservable } from 'redux-observable'
Expand All @@ -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(
Expand Down
1 change: 0 additions & 1 deletion examples/with-redux-observable/pages/other.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import Link from 'next/link'

const OtherPage = () => (
Expand Down
2 changes: 1 addition & 1 deletion examples/with-redux-persist/components/counter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Component } from 'react'
import { Component } from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { incrementCount, decrementCount, resetCount } from '../store'
Expand Down
2 changes: 1 addition & 1 deletion examples/with-redux-persist/components/data-list.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Component } from 'react'
import { Component } from 'react'
import { connect } from 'react-redux'
import { bindActionCreators } from 'redux'
import { loadExampleData, loadingExampleDataFailure } from '../store'
Expand Down
4 changes: 2 additions & 2 deletions examples/with-redux-persist/lib/with-redux-store.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import { Component } from 'react'
import { initializeStore } from '../store'

const isServer = typeof window === 'undefined'
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion examples/with-redux-persist/pages/_app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
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'
Expand Down
4 changes: 2 additions & 2 deletions examples/with-redux-persist/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
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`
Expand Down
2 changes: 0 additions & 2 deletions examples/with-redux-saga/components/clock.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react'

const pad = n => (n < 10 ? `0${n}` : n)

const format = t => {
Expand Down
2 changes: 1 addition & 1 deletion examples/with-redux-saga/components/counter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { Component } from 'react'
import { Component } from 'react'
import { connect } from 'react-redux'

import { increment, decrement, reset } from '../actions'
Expand Down
1 change: 0 additions & 1 deletion examples/with-redux-saga/pages/_app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
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'
Expand Down
4 changes: 2 additions & 2 deletions examples/with-redux-saga/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
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))
Expand Down
4 changes: 2 additions & 2 deletions examples/with-redux-saga/pages/other.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
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))
Expand Down
2 changes: 0 additions & 2 deletions examples/with-redux-thunk/components/clock.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react'

const pad = n => (n < 10 ? `0${n}` : n)

const format = t =>
Expand Down
1 change: 0 additions & 1 deletion examples/with-redux-thunk/components/counter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { useSelector, useDispatch } from 'react-redux'
import { incrementCount, decrementCount, resetCount } from '../actions'

Expand Down
1 change: 0 additions & 1 deletion examples/with-redux-thunk/components/examples.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { useSelector } from 'react-redux'
import Clock from './clock'
import Counter from './counter'
Expand Down
4 changes: 2 additions & 2 deletions examples/with-redux-thunk/lib/with-redux-store.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import { Component } from 'react'
import initializeStore from '../store'

const __NEXT_REDUX_STORE__ = '__NEXT_REDUX_STORE__'
Expand All @@ -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
Expand Down
1 change: 0 additions & 1 deletion examples/with-redux-thunk/pages/_app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { Provider } from 'react-redux'
import App from 'next/app'
import withReduxStore from '../lib/with-redux-store'
Expand Down
2 changes: 1 addition & 1 deletion examples/with-redux-thunk/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React, { PureComponent } from 'react'
import { PureComponent } from 'react'
import { connect } from 'react-redux'
import Link from 'next/link'
import { startClock, serverRenderClock } from '../actions'
Expand Down
1 change: 0 additions & 1 deletion examples/with-redux-thunk/pages/show-redux-state.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { connect } from 'react-redux'
import Link from 'next/link'

Expand Down
1 change: 0 additions & 1 deletion examples/with-redux-toolkit/components/clock.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { useSelector, shallowEqual } from 'react-redux'

const useClock = () => {
Expand Down
1 change: 0 additions & 1 deletion examples/with-redux-toolkit/components/counter.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { createAction } from '@reduxjs/toolkit'
import { useSelector, useDispatch } from 'react-redux'

Expand Down
1 change: 0 additions & 1 deletion examples/with-redux-toolkit/pages/_app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { Provider } from 'react-redux'
import { store } from '../store'

Expand Down
1 change: 0 additions & 1 deletion examples/with-redux-toolkit/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { createAction } from '@reduxjs/toolkit'
import { connect } from 'react-redux'
import useInterval from '../lib/useInterval'
Expand Down
2 changes: 0 additions & 2 deletions examples/with-styled-components/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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'

Expand Down Expand Up @@ -88,7 +87,6 @@ export default styled(StyledLink)`
**pages/index.js**

```javascript
import React from 'react'
import StyledLink from '../components/StyledLink'

export default () => (
Expand Down
1 change: 0 additions & 1 deletion examples/with-styled-components/pages/_app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import App from 'next/app'
import React from 'react'
import { ThemeProvider } from 'styled-components'

const theme = {
Expand Down
1 change: 0 additions & 1 deletion examples/with-styled-components/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import styled from 'styled-components'

const Title = styled.h1`
Expand Down

0 comments on commit b973c14

Please sign in to comment.