Reputation: 5685
How can I use react-swipe
as a component in my ReactJS app:
https://www.npmjs.org/package/react-swipe
I can get the example working from the react-swipe
NPM page, but when try something like below it doesn't work:
NOTE: If I use {React.DOM.div(null, carousel)}
instead of <carousel />
it works. How can I get this working using JSX ? I can't figure out the equivalent JSX.
var App = React.createClass({
render: function() {
return (
<div>
<carousel />
</div>
);
}
});
React.renderComponent((
<App />
), document.body);
Upvotes: 1
Views: 4495
Reputation: 5685
With fresh eyes and the blog post below I realized carousel
is not a React Component, it's just JavaScript. I was assuming Swipe() returned a ReactJS component. This works:
<div>{carousel}</div>
This blog helped me figure this out: https://www.packtpub.com/books/content/using-reactjs-without-jsx
Can also do this:
this.carousel = (
<Swipe continuous={false}>
<div>
<MyPrizesPane1 />
</div>
<div>
<MyPrizeOne />
</div>
</Swipe>
);
Upvotes: 3