Trouble using mixins

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?

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

1 Like

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

1 Like