Skip to content

how to call another jsx in jsx? #19

@eungchang

Description

@eungchang

i am user of spring boot. i tried to call test1.jsx in test2.jsx .

and i met this error message which from test2.jsx

`Uncaught SyntaxError: /test2.jsx: Unexpected token (9:8)
7 | function App() {
8 | this.AppView = React.createClass({

9 | var dd = Test1.App2();
| ^
10 | render: function () {
11 | return (
12 |

`

this is my main.js. almost same your example.

`require.config({

paths: {
    react:'lib/react/react',
    reactDOM: 'lib/react/react-dom',
    babel: 'lib/require-react-jsx/babel-5.8.34.min',
    jsx: 'lib/require-react-jsx/jsx',   
    text: 'lib/require-react-jsx/text',
    jquery: 'lib/jquery-2.2.0'  
},

shim: {
    "react": {
        "exports": "React"
    }
},

config: {
    babel: {
        sourceMaps: "inline", // One of [false, 'inline', 'both']. See https://babeljs.io/docs/usage/options/
        fileExtension: ".jsx" // Can be set to anything, like .es6 or .js. Defaults to .jsx
    }
}

});

require(['jsx!test2'], function(App){

  var app = new App();
  app.init();

});`

and this is my test1.jsx

`define(function(require){

var React = require('react');
var ReactDOM = require('reactDOM');

function App2() {
this.trouble = React.createClass({
render: function () {
return (


how to call here?



);
}
});
}

App2.prototype.init = function () {
ReactDOM.render(
)
};

return App2;

});`

this is my test2.jsx

`define(function(require){

var React = require('react');
var ReactDOM = require('reactDOM');
var Test1 = require('jsx!test1');

function App() {
this.AppView = React.createClass({
var dd = Test1.App2();
render: function () {
return (


Hello, React!

      </div>
    );
  }
});

}

App.prototype.init = function () {
ReactDOM.render(<this.AppView />,

document.getElementById("testRequire"));

};

return App;

});`

so, i don't know how to call

could give me a hint for that?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions