react-jsx

TypeError: undefined is not an object (evaluating 'this.__reactAutoBindMap')

情到浓时终转凉″ 提交于 2020-01-15 12:07:39
问题 I am working with the latest version of react.js installed by NPM. I've written this code which works when I put it through jsfiddle, but not when I try it in my own setup. Here is the code I'm working with: /** @jsx React.DOM */ var React = require('react'); var MyButton = React.createClass({ render: function(){ return ( <button onClick={this.props.onClick} >more!</button> ); } }); var Count = React.createClass({ getInitialState: function(){ return { counter: 0 }; }, increment: function(){

unclosed regular expression

雨燕双飞 提交于 2020-01-14 14:37:07
问题 I have the following code: render() { /* jshint laxbreak: true */ var buttonClasses = classSet({ 'Button' : true, }), buttonContainerClasses = classSet({ 'u-textRight': !this.props.fullscreen }), allowedTypes = /^(submit|button)$/i, type = allowedTypes.test(this.props.type) ? this.props.type : 'button'; return ( <div className={buttonContainerClasses}> <input type = {type} value = {this.props.label} /> </div> ); } and JSHint is giving me the following error: Unclosed regular expression on the

Check if all Child-Components have been mounted

元气小坏坏 提交于 2020-01-12 14:14:38
问题 Is there any way to detect if the childs have been mounted? When i initialize the Isotope, all children components must be mounted for the initialize. With a timeout of 5ms it is working like expected, but im sure there is a better way. componentDidMount: function() { var container = this.refs.vinesOverview.getDOMNode(); setTimeout(function() { var isotope = new Isotope(container, { itemSelector: ".vine_item", layoutMode: "masonry", resizable: true, gutter: 0, isFitWidth: true }); this

Check if all Child-Components have been mounted

て烟熏妆下的殇ゞ 提交于 2020-01-12 14:08:13
问题 Is there any way to detect if the childs have been mounted? When i initialize the Isotope, all children components must be mounted for the initialize. With a timeout of 5ms it is working like expected, but im sure there is a better way. componentDidMount: function() { var container = this.refs.vinesOverview.getDOMNode(); setTimeout(function() { var isotope = new Isotope(container, { itemSelector: ".vine_item", layoutMode: "masonry", resizable: true, gutter: 0, isFitWidth: true }); this

Check if all Child-Components have been mounted

懵懂的女人 提交于 2020-01-12 14:08:08
问题 Is there any way to detect if the childs have been mounted? When i initialize the Isotope, all children components must be mounted for the initialize. With a timeout of 5ms it is working like expected, but im sure there is a better way. componentDidMount: function() { var container = this.refs.vinesOverview.getDOMNode(); setTimeout(function() { var isotope = new Isotope(container, { itemSelector: ".vine_item", layoutMode: "masonry", resizable: true, gutter: 0, isFitWidth: true }); this

React render component using its name

痞子三分冷 提交于 2020-01-12 14:00:13
问题 I am experimenting React.js and it is working really well. I am wondering if it is possible to inject classes to other classes like so: var Container = React.createClass({ render: function() { <{this.props.implComponent}/> } }); Assuming implComponent has been passed like so: React.render( <Container implComponent="somePredefinedVariable" />, document.getElementById('content') ); This does not work because of a Syntax error. I can easily understand why. In other words I'd like to inject

React render component using its name

限于喜欢 提交于 2020-01-12 13:54:25
问题 I am experimenting React.js and it is working really well. I am wondering if it is possible to inject classes to other classes like so: var Container = React.createClass({ render: function() { <{this.props.implComponent}/> } }); Assuming implComponent has been passed like so: React.render( <Container implComponent="somePredefinedVariable" />, document.getElementById('content') ); This does not work because of a Syntax error. I can easily understand why. In other words I'd like to inject

Render multiple components in React Router

倖福魔咒の 提交于 2020-01-12 07:52:06
问题 I'm used to application layouts with multiple yield areas, i.e. for content area and for top bar title. I'd like to achieve something similar in React Router. For example: <Router> <Route path="/" component = { AppLayout }> <Route path="list" component = { ListView } topBarComponent = { ListTopBar }/> </Route> </Router> AppLayout: <div className="appLayout box"> <div className="appLayout topBar"> { -- display ListTopBar here -- } </div> <div className="appLayout content"> { -- display

Possible to multiply or concat JSX?

微笑、不失礼 提交于 2020-01-11 10:47:31
问题 I'm using React along with Font Awesome to create a row of stars. I have a function that takes a number and produces that many stars. I'm trying to find the best way to do this within a react component. Basically, I need to multiply the JSX element by a number to get it to repeat dynamically based on what's passed in: reviewStars(num) { const star = <i className="fa fa-star" aria-hidden="true"></i>; const getStarCount = star.repeat(num); return getStarCount; }; If the JSX was a string, this

Possible to multiply or concat JSX?

筅森魡賤 提交于 2020-01-11 10:47:07
问题 I'm using React along with Font Awesome to create a row of stars. I have a function that takes a number and produces that many stars. I'm trying to find the best way to do this within a react component. Basically, I need to multiply the JSX element by a number to get it to repeat dynamically based on what's passed in: reviewStars(num) { const star = <i className="fa fa-star" aria-hidden="true"></i>; const getStarCount = star.repeat(num); return getStarCount; }; If the JSX was a string, this