Skip to content

Error with classnames package #13

Closed
@xDae

Description

@xDae

Trying the babel plugin with the classnames package im getting errors:

captura de pantalla 2016-12-14 a las 17 48 23

the Button Component is so easy:

import React, { PropTypes } from 'react';
import classNames from 'classnames';

import './button.scss';

const Button = ({ className, href, type, alt, children, onClick }) => {
  var btnClass = classNames('button', className, {
    'default': type === 'default',
    'alt': type === 'alt'
  });

  return (
    <button
      styleName={btnClass}
      onClick={onClick}
    >
      {children}
    </button>
  );
};

export default Button;

Without the classname package its working fine:

import React, { PropTypes } from 'react';

import './button.scss';

const Button = ({ className, href, type, alt, children, onClick }) => {
  return (
    <button
      styleName="button default"
      onClick={onClick}
    >
      {children}
    </button>
  );
};

export default Button;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions