score:2
you are using named es6 import syntax:
import {reacttransitiongroup} from 'react-addons-transition-group';
this is not the same as using es6 default import syntax:
import reacttransitiongroup from 'react-addons-transition-group';
if you use es6 modules, it is paramount that you understand the difference between named and default imports. a module can have a single default export and/or many named exports, and there is a big difference between them.
now, react-addons-transition-group
is not an es module. it is a commonjs package published on npm. the official examples show how to use it in a commonjs environment:
var reactcsstransitiongroup = require('react-addons-css-transition-group');
you probably use a transpiler like babel. in this case it’s important that you understand how babel interops with commonjs modules. commonjs is not like es modules and doesn’t have a concept of named or default exports. this is why babel interprets modules written in commonjs style as having only a single default export, and no named exports. of course, es modules compiled with babel include special hints so it can recognize them later, but this isn’t the case for react-addons-css-transition-group
which was originally written in commonjs style.
this is why
var reactcsstransitiongroup = require('react-addons-css-transition-group');
corresponds to
import reacttransitiongroup from 'react-addons-transition-group';
and not
import {reacttransitiongroup} from 'react-addons-transition-group';
Source: stackoverflow.com
Related Query
- Low level react animation API unable to make it work
- How to make react router work with static assets, html5 mode, history API and nested routes?
- Can't make Context API work on React application, Uncaught TypeError: react__WEBPACK_IMPORTED_MODULE_0__.useContext(...) is not iterable
- How to make infinite scroll work with react and intersection api while lazily fetching data?
- Express Node.js + React Router unable to make API calls? "Access-Control-Origin"
- Unable to make api calls from React Single Page app
- React Component unable to make request to Google API
- CSS animation On ReactJS Project Unable to make it work
- Make api requests work from another computer on the same network in a react app
- How can I make React Portal work with React Hook?
- How should the new context api work with React Native navigator?
- How to make React HOC - High Order Components work together?
- Unable to make API calls using react-native
- Unable to make the Checkbox work with redux-form and react-semantic-ui
- How to make the API call and display it in React JS using React Table and Axios?
- How to make React storybook 'addon-links' work
- How to make shaking image animation in React Native?
- Getting SSR to work with the React Context API
- How to make synchronous API call request in react js
- How to make Relay and React Routing work properly?
- Make scroll to top button with animation in React
- How to make a multiple api call on submission of a form in react
- Do I use one server or two servers if I want to serve React files AND make API calls?
- How to make a React multi-step form work with React Router?
- In React with Redux how to make double colons work
- React Hooks & React-Redux connect: What is the best practice to make them work together?
- React : make backend API call when user is authenticated, use LocalStorage if not
- How can I make a request to an API based on the response from another request? React Hook "useSwr" cannot be called inside a callback
- Unable to set props values after delete the record from the list in React context API
- How should I make API calls in React container components?
More Query from same tag
- React-router - check for empty state and redirect?
- how to handle multiple refs inside a map function
- What is the correct way to pass parameters to a React-query useQuery method that uses Axios
- react undux testing (mock) with jest
- Declaring React Routes in a separate file and Importing
- What does the es6 { [a]: b } destructuring mean?
- (Spotify) Playing a 30 second preview while signed in
- Why React.memo and shouldComponentUpdate aren't doing the same?
- union types not being recognised in React
- React - Child not rendered correctly
- Reading an URL before it actually links there
- Firebase: No Firebase App '[DEFAULT]' has been created when using Reserved Hosting URL
- Response is undefined in promise.then() for nested object
- Local Image Path in ReactJs
- How to render html string in reactjs
- How to set timeout on event onChange
- React infinite loop returned by array even with dependency added
- React Toggle open and close using onclick on map function
- show average rating in read mode and just total or half value in write mode
- Pass Current Table Row values to a subcomponent with onClick of a button in React (Material UI)
- I got an Error: Objects are not valid as a React child (found: [object Promise])
- How to make a counter using React Hooks which depends on two buttons start and stop?
- How to change placeholder position by margin padding in Tailwind CSS?
- TypeError: (intermediate value)(intermediate value)(intermediate value) is not iterable
- Add Edit Button in react-bootstrap-table
- Passing info from a Form into a function React js
- download sample file in public folder (react)
- How to disable dates in React nice dates?
- How to dynamically inject a div in the React way?
- Cannot read property 'company' of null