Chirag Patel
Chirag Patel

Reputation: 3

separation of JSX file module wise

I have 2 JSX files

  1. Main.jsx

      ReactDOM.render(
     <SearchExample items={libraries} />,
     document.getElementById('container')
    

    );

    ReactDOM.render( , document.getElementById('container11') );

  2. ParentComponent.jsx

    var ChildComponent = React.createClass({ render: function () { return ( Add a click handler to this button so that when clicked, performMagic is called in the parent component. Do Magic ); } });

    var ParentComponent = React.createClass({ performMagic: function () { alert('TAADAH!'); },

     render: function () {
         return (
             <div>
                 <ChildComponent onMagicClick={this.performMagic} />
             </div>
         );
     }
    

    });

here I am unable to call ParentComponent. Note: I don't want to use web pack or other bundles configures. also not want to use script tag.

Also, my main file depends on multiple files.like SearchExample.jsx, ParentComponent.jsx etc.

here may be SearchExample.jsx is also depending on some other files that contain static value/configuration/property.

I am unable to use require and import without any other library.

Upvotes: 0

Views: 101

Answers (1)

Florent Giraud
Florent Giraud

Reputation: 225

What you want its impossible. If you dont import or put all in the same files. Maybe explain more what you want to do

Upvotes: 0

Related Questions