当ReactMeteorData mixin存在时,App不会呈现

时间:2016-01-19 16:33:37

标签: meteor meteor-react

我想提出一些奇怪问题的建议。 我用

创建了一个最小的Meteor应用程序
SELECT OBJECT_SCHEMA_NAME(s.[object_id]) + '.' + OBJECT_NAME(s.[object_id])
FROM sys.sql_modules s
WHERE s.[definition] LIKE '%sp_send_dbmail%'

SELECT s1.name
FROM msdb.dbo.sysjobsteps s
JOIN msdb.dbo.sysjobs s1 ON s.job_id = s1.job_id
WHERE s.subsystem = 'TSQL'
    AND s.command LIKE '%sp_send_dbmail%'

并添加以下main.jsx文件:

meteor create testreactmeteordata  
cd testreactmeteordata  
meteor add react kadira:react-layout kadira:flow-router  
rm testreactmeteordata.*

除非删除了 mixins: 行,否则这不会呈现任何内容!?

这是这个小项目中使用的版本:

if (Meteor.isClient) {
    App = React.createClass({
        mixins: [ReactMeteorData],
        render() {
            return (
                <div>
                    <h1>App</h1>
                </div>
            )
        }
    });
}

FlowRouter.route('/', {
    name: 'Dashboard',
    action() {
        ReactLayout.render(App);
    }
});

更新流星并没有多大帮助:

$ meteor list
autopublish           1.0.4  (For prototyping only) Publish the entire databa...
blaze-html-templates  1.0.1  Compile HTML templates into reactive UI with Met...
ecmascript            0.1.6* Compiler plugin that supports ES2015+ in all .js...
es5-shim              4.1.14  Shims and polyfills to improve ECMAScript 5 sup...
insecure              1.0.4  (For prototyping only) Allow all database writes...
jquery                1.11.4  Manipulate the DOM using CSS selectors
kadira:flow-router    2.10.0  Carefully Designed Client Side Router for Meteor
kadira:react-layout   1.5.3  Layout Manager for React with SSR Support
meteor-base           1.0.1  Packages that every Meteor app needs
mobile-experience     1.0.1  Packages for a great mobile user experience
mongo                 1.1.3  Adaptor for using MongoDB and Minimongo over DDP
react                 0.14.3* Everything you need to use React with Meteor.
session               1.1.1  Session variable
standard-minifiers    1.0.2  Standard minifiers used with Meteor apps by defa...
tracker               1.0.9  Dependency tracker to allow reactive callbacks


* New versions of these packages are available! Run 'meteor update' to try to
  update those packages to their latest versions. If your packages cannot be
  updated further, try typing `meteor add <package>@<newVersion>` to see more
  information.

尝试按照建议手动升级反应显示出一堆疑惑:

2016-01-19 16:41 ~/src/meteor/testreactmeteordata
$ meteor update
This project is already at Meteor 1.2.1, the latest release.
Your top-level dependencies are at their latest compatible versions.

The following top-level dependencies were not updated to the very latest
version available:
 * react 0.14.3 (0.14.3_1 is available)

Newer versions of the following indirect dependencies are available:
 * jsx 0.2.3 (0.2.4 is available)
 * react-meteor-data 0.2.4 (0.2.5 is available)
To update one or more of these packages, pass their names to `meteor update`.

请告知。

TIA,

1 个答案:

答案 0 :(得分:4)

您需要在getMeteorData中实施ReactComponent方法。考虑mixins就像一个界面。当你在类中使用时,这意味着你的类正在实现它,因此需要一个实现