Using React 0.14.8 I see following behavior:
When I want to import actions for Redux, I should import like that:
import {setSomeVar} from './actions.js'
if I try to import like I'm used to import single React components, without curly braces:
import setSomeVar from './actions.js'
after bundling I see following exception on doing
this.props.dispatch(setSomeVar(someVar))
I see this exception:
Uncaught TypeError: (0 , _action2.default) is not a function
Hi! We use React issue tracker for bugs in React.
What you describe sounds more like a usage question about Redux.
We ask that you ask usage questions on StackOverflow instead.
Please feel free to leave a link here in the comment!
Cheers.
As for your question, you might find this helpful: http://stackoverflow.com/questions/36795819/react-native-es-6-when-should-i-use-curly-braces-for-import/36796281#36796281
I had the same Issue. From the actions.js
function should have export
. example
export function blah(){..}
then it does not show the error.
Found this from Google.
In my case it was because I was importing A.js
from B.js
, and B.js
from A.js
.
i am also face this error in
export default function getUser() {...}
then i removed default from function and now its work, like
export function getUser() {...}
Most helpful comment
As for your question, you might find this helpful: http://stackoverflow.com/questions/36795819/react-native-es-6-when-should-i-use-curly-braces-for-import/36796281#36796281