Skip to content

PROOF-OF-CONCEPT: Externalized React, React-DOM to support React Addons - #221

Closed
frol wants to merge 1 commit into
vercel:masterfrom
frol:proof-of-concept-external-react
Closed

frol wants to merge 1 commit into
vercel:masterfrom
frol:proof-of-concept-external-react

Conversation

@frol

@frol frol commented Nov 7, 2016 •

Copy link
Copy Markdown
Contributor

This is not intended for merge!

This is the result of my experiments with React-MD (#196), Material-UI (#119), and others relying on react-addons-* (#204).

To make React Addons usable in Next.js out of the box, Next.js has to accomplish the following:

Here are the steps to get a working project with React-MD:

  1. package.json:

    {
      "name": "my-app",
      "dependencies": {
        "next": "^1.1.1",
        "react-addons-css-transition-group": "^15.3.2",
        "react-addons-pure-render-mixin": "^15.3.2",
        "react-addons-transition-group": "^15.3.2",
        "react-md": "^0.3.7"
      },
      "scripts": {
        "test": "jest",
        "dev": "next",
        "build": "next build",
        "start": "next start"
      },
      "devDependencies": {
        "babel-jest": "^16.0.0",
        "enzyme": "^2.5.1",
        "jest": "^16.0.2",
        "react-addons-test-utils": "^15.3.2"
      },
      "babel": {
        "presets": [
          "es2015",
          "react"
        ]
      }
    }
  2. pages/index.js:

    import React from 'react'
    import Head from 'next/head'
    import { RaisedButton } from 'react-md/lib/Buttons'
    
    export default class App extends React.Component {
      render() {
        return <div>
          <Head>
            <link rel="stylesheet" href="https://npmcdn.com/react-md/dist/react-md.css" />
            <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:300,400,500" />
            <link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Material+Icons" />
          </Head>
     
          <RaisedButton label="I am a button!" />
        </div>
      }
    }
  3. npm install

  4. Fetch these changes and compile Next.js yourself, or extract this dist into ./node_modules/next/dist: dist.tar.gz

  5. npm run dev

/cc @nkzawa

@frol frol mentioned this pull request Nov 7, 2016
@rauchg

rauchg commented Dec 17, 2016

Copy link
Copy Markdown
Member

Fixed by @arunoda

@rauchg rauchg closed this Dec 17, 2016
@lock lock Bot locked as resolved and limited conversation to collaborators Jan 19, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants