Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
default
✓ import React from 'motion-react'
✗ import * as React from 'motion-react'
React is the default export; wildcard import will not work as expected.
Component
✓ import React, { Component } from 'motion-react'
Named export Component is available alongside default.
Motion
✓ import { Motion, spring } from 'motion-react'
✗ import { Motion } from 'react-motion'
Motion primitive is included in this package, not react-motion.
require
✓ const React = require('motion-react')
✗ var React = require('react')
CommonJS require must use package name 'motion-react'.
Shows basic use of built-in Motion primitive for animations, rendering an animated div.
import React, { Component, Motion, spring } from 'motion-react';
import { render } from 'react-dom';
class AnimatedDiv extends Component {
render() {
return (
<Motion defaultStyle={{ x: 0 }} style={{ x: spring(100) }}>
{interpolating => <div style={{ transform: `translateX(${interpolating.x}px)` }} />}
</Motion>
);
}
}
render(<AnimatedDiv />, document.getElementById('root'));
Debug
Known issues
breakingThis package (motion-react) is a pre-release alpha fork. It is NOT compatible with standard React packages (react, react-dom).fixDo not mix with regular React packages. Use only motion-react for all React APIs.
affects: >=0.0.0
deprecatedThis version (0.15.0-alpha.1) is old and unmaintained. The motion primitives are not compatible with modern React.fixMigrate to a proper animation library (e.g., framer-motion) or use standard React with react-motion.
affects: >=0.15.0-alpha.1
gotchaUsing require('motion-react') in an ESM environment (module type in package.json) will cause a ReferenceError.fixUse import syntax in ESM contexts.
affects: >=0.15.0-alpha.1
gotchaThe spring function must be imported explicitly; it is not accessible as React.spring.fiximport { spring } from 'motion-react'; affects: >=0.15.0-alpha.1
Errors
Common errors & fixes
Module not found: Can't resolve 'react'
Importing 'react' instead of 'motion-react'.
fixReplace 'react' with 'motion-react' in imports.
Uncaught ReferenceError: require is not defined
Using CommonJS require in an ESM environment.
fixUse import syntax or change module system.
TypeError: Cannot read properties of undefined (reading 'createElement')
Using wildcard import (import * as React) which breaks default export.
fixUse import React from 'motion-react'.
Upgrade
Version history
0.15.0-alpha.1latest on npm
Audit
Dependencies
No dependency data recorded yet.