Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixing Redundant React imports on next.js/examples #13384

Merged
merged 7 commits into from
May 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions examples/with-ant-design/pages/_app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import React from 'react'

import 'antd/dist/antd.css'
import '../styles/vars.css'
import '../styles/global.css'
Expand Down
14 changes: 5 additions & 9 deletions examples/with-dynamic-import/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,17 @@
import React, { useState } from 'react'
import { useState } from 'react'
import Header from '../components/Header'
import dynamic from 'next/dynamic'

const DynamicComponent1 = dynamic(() => import('../components/hello1'))

const DynamicComponent2WithCustomLoading = dynamic(
() => import('../components/hello2'),
{
loading: () => <p>Loading caused by client page transition ...</p>,
}
{ loading: () => <p>Loading caused by client page transition ...</p> }
)

const DynamicComponent3WithNoSSR = dynamic(
() => import('../components/hello3'),
{
loading: () => <p>Loading ...</p>,
ssr: false,
}
{ loading: () => <p>Loading ...</p>, ssr: false }
)

const DynamicComponent4 = dynamic(() => import('../components/hello4'))
Expand All @@ -25,6 +20,7 @@ const DynamicComponent5 = dynamic(() => import('../components/hello5'))

const IndexPage = () => {
const [showMore, setShowMore] = useState(false)
const [falsyField] = useState(false)

return (
<div>
Expand All @@ -40,7 +36,7 @@ const IndexPage = () => {
<DynamicComponent3WithNoSSR />

{/* This component will never be loaded */}
{React.noSuchField && <DynamicComponent4 />}
{falsyField && <DynamicComponent4 />}

{/* Load on demand */}
{showMore && <DynamicComponent5 />}
Expand Down
1 change: 0 additions & 1 deletion examples/with-iron-session/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import Layout from '../components/Layout'

const Home = () => (
Expand Down
1 change: 0 additions & 1 deletion examples/with-iron-session/pages/login.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { useState } from 'react'
import useUser from '../lib/useUser'
import Layout from '../components/Layout'
Expand Down
1 change: 0 additions & 1 deletion examples/with-iron-session/pages/profile-sg.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import useUser from '../lib/useUser'
import Layout from '../components/Layout'

Expand Down
1 change: 0 additions & 1 deletion examples/with-iron-session/pages/profile-ssr.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import Layout from '../components/Layout'
import withSession from '../lib/session'
import PropTypes from 'prop-types'
Expand Down
1 change: 0 additions & 1 deletion examples/with-monaco-editor/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import dynamic from 'next/dynamic'

import sample from '../code-sample'
Expand Down
1 change: 0 additions & 1 deletion examples/with-next-page-transitions/pages/_app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { PageTransition } from 'next-page-transitions'

import Loader from '../components/Loader'
Expand Down
1 change: 0 additions & 1 deletion examples/with-next-page-transitions/pages/_document.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import Document, { Head, Main, NextScript } from 'next/document'

export default class MyDocument extends Document {
Expand Down
1 change: 0 additions & 1 deletion examples/with-next-page-transitions/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'

const Index = () => (
Expand Down
1 change: 0 additions & 1 deletion examples/with-react-with-styles/pages/_app.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { DIRECTIONS } from 'react-with-direction'
import AphroditeInterface from 'react-with-styles-interface-aphrodite'
import WithStylesContext from 'react-with-styles/lib/WithStylesContext'
Expand Down
1 change: 0 additions & 1 deletion examples/with-react-with-styles/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import React from 'react'
import { css, withStyles } from 'react-with-styles'

function Home({ styles }) {
Expand Down
6 changes: 3 additions & 3 deletions examples/with-style-sheet/pages/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import React from 'react'
import { useState, useEffect } from 'react'
import { StyleSheet, StyleResolver } from 'style-sheet'
const cls = StyleResolver.resolve

export default function Home() {
const [color, setColor] = React.useState('#111')
React.useEffect(() => {
const [color, setColor] = useState('#111')
useEffect(() => {
setTimeout(() => {
setColor('#00f')
}, 2000)
Expand Down