Trouble using mixins


#1

I’ve got a mixin I’ve defined, in /client/mixins:

FormMixin = {
   // ...
};

But in /client/components/LoginForm/LoginForm.jsx, when I try to use the mixin, I get an error that it’s undefined:

LoginForm = React.createClass({
  displayName: 'LoginForm',
  mixins: [FormMixin],
  // ...

But I don’t think it’s a scope issue, because if I do a console.log(FormMixin) in LoginForm's render method, it dumps it out just fine. What am I missing here?


#2

Moving /client/mixins to /client/lib/mixins did the trick.


#3

You beat me to it :laughing: The FormMixin is evaluated before the render which is why it places undefined in the mixins array.