Skip to content
This repository has been archived by the owner on Dec 31, 2018. It is now read-only.

Upgrading from v1.1.0 to v1.2.0

Steel Brain edited this page May 13, 2016 · 1 revision

There are several important changes in this version, some of them are

  • Instead of always requiring $root/index.js, it now reads the $root/package.json and tries to load the file mentioned in the main field, still falls back to $root/index.js if no main is specified or manifest doesn't exist
  • Instead of handling the rendering of the app magically, it now lets users choose how an app is rendered; giving you the full control over your app.
  • motion new app now creates an app with the new and recommended structure

Migration to the new version is easy, simply rename your current index.js to main.js and paste this in a new file and save it as index.js.

import React from 'react'
import ReactDOM from 'react-dom'
import Main from './main'

if (typeof Main === 'function') {
  ReactDOM.render(React.createElement(Main), document.getElementById('app'))
} else {
  console.error('No default view exported from the main file')
}

if (process.env.NODE_ENV === 'development' && module.hot) {
  module.hot.accept()
}
Clone this wiki locally