最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Uncaught ReferenceError: Component not defined in Meteor - Stack Overflow

programmeradmin3浏览0评论

I'm trying to display my Deal ponent but I keep getting this error below.

I'm using Meteor with ReactJS.

Uncaught ReferenceError: Deal is not defined at meteorInstall.imports.routes.routes.js

Here is my routes.js file

<Route path="/deals" ponent={Deal} secure="auth" />

My Deal.js ponent file, that the route should be linking too.

import React from 'react';
import { Link } from 'react-router';
import PrivateHeaderNav from './PrivateHeaderNav.js'

export default class Deal extends React.Component {
  render() {
    return (
      <div className="content">
        <PrivateHeaderNav/>
        Deal
      </div>
    );
  }

}

Am I missing something in the imports or in my Deal ponent?

Thanks

I'm trying to display my Deal ponent but I keep getting this error below.

I'm using Meteor with ReactJS.

Uncaught ReferenceError: Deal is not defined at meteorInstall.imports.routes.routes.js

Here is my routes.js file

<Route path="/deals" ponent={Deal} secure="auth" />

My Deal.js ponent file, that the route should be linking too.

import React from 'react';
import { Link } from 'react-router';
import PrivateHeaderNav from './PrivateHeaderNav.js'

export default class Deal extends React.Component {
  render() {
    return (
      <div className="content">
        <PrivateHeaderNav/>
        Deal
      </div>
    );
  }

}

Am I missing something in the imports or in my Deal ponent?

Thanks

Share Improve this question asked Apr 28, 2017 at 20:51 calacala 1,4217 gold badges22 silver badges44 bronze badges 4
  • 1 I think the error message suggests that Deal is not defined, meaning it is not imported, if it is defined in another file. Can you post the import line in from route.js? If the import file path was wrong the error would have been different. – Gratus D. Commented Apr 28, 2017 at 20:54
  • @GratusD. yes, I didn't import it in my routes file, that was the error, fixed now. Thanks! – cala Commented Apr 28, 2017 at 20:57
  • ops didn't see that ment :) – Sagiv b.g Commented Apr 28, 2017 at 20:58
  • @Sag1v No problem :) thanks! – cala Commented Apr 28, 2017 at 20:59
Add a ment  | 

1 Answer 1

Reset to default 4

Your routes.js file is lacking the import of Deal ponent.
make sure you have this line in route.js:

import Deal from './path/to/Deal.js';
发布评论

评论列表(0)

  1. 暂无评论