Unverified Commit 2828b019 authored by Jesse Jafa's avatar Jesse Jafa Committed by GitHub

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

Per https://github.com/zeit/next.js/issues/12964

* with-ant-design
* with-dynamic-import
* with-iron-session
* with-monaco-editor
* with-next-page-transitions
* with-react-with-styles
* with-style-sheet
* with-why-did-you-render

Tested each example, working as intended, no additional issues presented
parent d56d5e68
import React from 'react'
import 'antd/dist/antd.css'
import '../styles/vars.css'
import '../styles/global.css'
......
import React, { useState } from 'react'
import { useState } from 'react'
import Header from '../components/Header'
import dynamic from 'next/dynamic'
......@@ -6,17 +6,12 @@ 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'))
......@@ -25,6 +20,7 @@ const DynamicComponent5 = dynamic(() => import('../components/hello5'))
const IndexPage = () => {
const [showMore, setShowMore] = useState(false)
const [falsyField] = useState(false)
return (
<div>
......@@ -40,7 +36,7 @@ const IndexPage = () => {
<DynamicComponent3WithNoSSR />
{/* This component will never be loaded */}
{React.noSuchField && <DynamicComponent4 />}
{falsyField && <DynamicComponent4 />}
{/* Load on demand */}
{showMore && <DynamicComponent5 />}
......
import React from 'react'
import Layout from '../components/Layout'
const Home = () => (
......
import React from 'react'
import { useState } from 'react'
import useUser from '../lib/useUser'
import Layout from '../components/Layout'
......
import React from 'react'
import useUser from '../lib/useUser'
import Layout from '../components/Layout'
......
import React from 'react'
import Layout from '../components/Layout'
import withSession from '../lib/session'
import PropTypes from 'prop-types'
......
import React from 'react'
import dynamic from 'next/dynamic'
import sample from '../code-sample'
......
import React from 'react'
import { PageTransition } from 'next-page-transitions'
import Loader from '../components/Loader'
......
import React from 'react'
import Document, { Head, Main, NextScript } from 'next/document'
export default class MyDocument extends Document {
......
import React from 'react'
import Link from 'next/link'
const Index = () => (
......
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'
......
import React from 'react'
import { css, withStyles } from 'react-with-styles'
function Home({ styles }) {
......
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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment