未捕获的ReferenceError:未定义行React-foundation

时间:2017-08-23 06:29:55

标签: reactjs zurb-foundation

我已经在我的反应项目中安装了Foundation,即使在导入它之后,它仍然无法定义基础

import React, { PropTypes } from 'react';
import { Link, IndexLink } from 'react-router';
import Auth from '../modules/Auth';
import DrawerLeft from './Drawer.jsx';
import Foundation from 'react-foundation';


const Base = ({ children }) => (
  <div>
    <div className="top-bar">
      <Row>
        <Column small={2} large={4}>TESTING</Column>
      </Row>

      {Auth.isUserAuthenticated() ? (
        <div className="top-bar-right">
          <Link to="/logout">Exit</Link>
        </div>
      ) : (
        <div className="top-bar-right">
          <Link to="/login">Enter</Link>
          <Link to="/signup">Join</Link>
        </div>
      )}

    </div>

    { /* child component will be rendered here */ }
    {children}
  </div>
);

Base.propTypes = {
  children: PropTypes.object.isRequired
};

export default Base;

在我的package.json中,它说&#34; react-foundation&#34;:&#34; ^ 0.8.2&#34;在依赖项下

2 个答案:

答案 0 :(得分:2)

您需要像这样导入

import { Row, Column } from 'react-foundation';

此外,您还需要Column

答案 1 :(得分:1)

npm package link to the Grid Code,您可以在Row中看到Columnnamed exportsreact-foundation,因此您可以将其导入为

 import {Row, Column} from 'react-foundation';

并使用它们