Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

useage example #1

Open
tnrich opened this issue May 27, 2015 · 1 comment
Open

useage example #1

tnrich opened this issue May 27, 2015 · 1 comment

Comments

@tnrich
Copy link

tnrich commented May 27, 2015

Hey there @piotrpalek, I'm interested in using the component you've created, but am a little unsure about how to actually go about using it after it's set up.

Would the syntax be something like:

var reactComponent = Ext.create('Ws.react.Cmp', {
react: ...? not sure what would go here...
})

Any help would be greatly appreciated,
Thanks!

@piotrpalek
Copy link
Owner

I am pretty unsure myself as this wasn't really used much and since then I didn't really work with ExtJS ;) and you have to remember this was written for an early version of React and not updated since then.

That said I think you would need to define your react component in the react property. So if you look at the https://github.com/piotrpalek/ExtJS-React/blob/master/Cmp.js source it runs React.createClass on the this.react property. This means that if you take a react component from the tutorial on the website:

var CommentBox = React.createClass({
  render: function() {
    return (
      <div className="commentBox">
        Hello, world! I am a CommentBox.
      </div>
    );
  }
});

You probably would have to define the component like this:

var reactComponent = Ext.create('Ws.react.Cmp', {
  react: {
    render: function() {
      return (
        <div className="commentBox">
          Hello, world! I am a CommentBox.
        </div>
      );
    }
  }
});

I just noticed I used React.renderComponent (in the Cmp.js file) and this was since changed to React.render so it probably won't work with the newset react.js version. You would have to update the code to make it work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants