Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/374.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 新版本的语法是什么_Javascript_Node.js_Reactjs - Fatal编程技术网

Javascript 新版本的语法是什么

Javascript 新版本的语法是什么,javascript,node.js,reactjs,Javascript,Node.js,Reactjs,伙计们,我想在App.js表单index.js上打印一些组件 但是我一直得到的模块没有发现错误,我注意到我的语法是过时的,谁能告诉我如何在较新的版本,这是代码 我们在App.js上写些什么来打印它们 var DATA = { name: 'John Smith', imgURL: 'http://lorempixel.com/100/100/', hobbyList: ['coding', 'writing', 'skiing'] } var App =

伙计们,我想在App.js表单index.js上打印一些组件

但是我一直得到的模块没有发现错误,我注意到我的语法是过时的,谁能告诉我如何在较新的版本,这是代码 我们在App.js上写些什么来打印它们

    var DATA = {    
    name: 'John Smith',
    imgURL: 'http://lorempixel.com/100/100/',
    hobbyList: ['coding', 'writing', 'skiing']
}
var App = React.createClass({
    render: function(){
        return (
            <div>
                <Profile 
                    name={this.props.profileData.name} 
                    imgURL={this.props.profileData.imgURL}/>
                <Hobbies
                    hobbyList={this.props.profileData.hobbyList} />
            </div>
        );
    }
});

一旦构建了配置文件和组件,您还需要导入这些组件

import React, { Component } from 'react';
import ReactDOM from 'react-dom';

const DATA = {    
    name: 'John Smith',
    imgURL: 'http://lorempixel.com/100/100/',
    hobbyList: ['coding', 'writing', 'skiing']
}
class App extends Component {
    render() {
        const { profileData: { name, imgURL, hobbyList } } = this.props;
        return (
            <div>
                <Profile 
                    name={name} 
                    imgURL={imgURL}/>
                <Hobbies
                    hobbyList={hobbyList} />
            </div>
        );
    }
}

ReactDOM.render(<App profileData={DATA} />, document.getElementById('root'));

找不到模具错误?请在导出应用程序时发布您收到的确切错误消息?然后你要在index.js中导入它吗?我正在尝试将index.js导入App.jx,以便在页面上打印出错误:重复声明配置文件39 | var App2=require'create-react-class';40 |>41 | var Profile=App2{|^42 | render:function{43 | return 44 |您不需要创建react类。您是否在关注教程或博客帖子?是的,我正在尝试这家伙正在做的事情。该教程现在已经过时。我建议使用其他资源。这是一个很好的入门课程:以下是教程的更新代码:我在twitter上(如果你还有任何问题或需要帮助寻找教程或课程。我教自己一段时间后做出反应,不介意帮助!