danawoodman / react-fontawesome

A React Font Awesome component.
https://www.npmjs.com/package/react-fontawesome
MIT License
667 stars 72 forks source link

Not working with React 15.3.2 #25

Closed joeyfigaro closed 7 years ago

joeyfigaro commented 7 years ago

Warning: React.createElement: type should not be null, undefined, boolean, or number. It should be a string (for DOM elements) or a ReactClass (for composite components).

Navigation.js

import React from 'react';
import { Link } from 'react-router';
import Image from './tags/Image';
import { FontAwesome as Icon } from 'react-fontawesome';

const Navigation = () => {
    return (
        <nav className="nav primary">
            <Link className="logo" to="/dashboard">
                <Icon
                                       className="icon"
                    name="rocket"
                    size="2x"
                    spin
                />
                <Image src="/images/logo.png" />
            </Link>
            <Link activeClassName="active" to="/users">Users</Link>
            <Link activeClassName="active" to="/transactions">Transactions</Link>
            <Link className="logout" activeClassName="active" to="/logout">Logout</Link>
        </nav>
    );
};

export default Navigation;
electic commented 7 years ago

seeing the same thing too

trakout commented 7 years ago

Was able to fix this by using single-function import syntax:

import FontAwesome from 'react-fontawesome'

proclaim commented 7 years ago

tried that and still does not work for me =(

import React, { Component } from 'react';
import FontAwesome from 'react-fontawesome';
import './main-header.scss';

class Header extends Component {
    render() {
        return (
            <div className="main-header">
                <div className="control-nav">L
                    <FontAwesome name="bar" />
                </div>
                <div className="title">title</div>
                <div className="control-mode">R</div>
            </div>
        );
    }
}

export default Header;
colemerrick commented 7 years ago

@trakout worked for me

danawoodman commented 7 years ago

@proclaim what issue are you seeing?

The proper import syntax is as @trakout mentioned, so will close this. @proclaim if you still have an issue, open up a new ticket and I'll have a look.