react-jsx

Reactjs - Higher Order Component / findDOMNode not working correctly

☆樱花仙子☆ 提交于 2019-12-12 00:38:23
问题 I created a HOC to listen for clicks outside its wrapped component, so that the wrapped component can listen and react as needed. The HOC looks like this : const addOutsideClickListener = (WrappedComponent) => { class wrapperComponent extends React.Component { constructor() { super(); this._handleClickOutside.bind(this); } componentDidMount() { document.addEventListener('click', this._handleClickOutside, true); } componentWillUnmount() { document.removeEventListener('click', this.

React JSX transformer in Windows

霸气de小男生 提交于 2019-12-11 20:13:10
问题 It seems to do nothing? According to this commit, the JSX transformer should work now. The command I'm attempting to use at the moment: C:\Node> node node_modules/react-tools/bin/jsx --watch S:/dev/_res/jsx/ S:/dev/_res/js/ Changing the / to \ has no effect. Neither does double-quoting the paths. When I run this command it returns with no errors and seems to have run fine. However absolutely nothing happens. I have some test JSX code in C:\dev\_res\jsx\test.js which should transpile after

Client-side JSX transpiling

元气小坏坏 提交于 2019-12-11 14:10:35
问题 I want to create React applications with JSX and not have to use a terminal or any server-side/dev environment commands. The environment we are using doesn't allow for commands to be run in the dev environment and these applications will be purely statically hosted on a CDN. So I know I can simply include Babel's browser.js to do the JSX transpiling in the browser. Perfect. My concern is that Babel apparently stopped supporting this and modern versions of Babel have it removed. Is there

dynamic tag name from string in JSX

不想你离开。 提交于 2019-12-11 12:03:37
问题 I am trying to create a page with all the icons from react-material-ui . I have found this answer but it does not work for me. I can create the tag alright but it gets converted to all lowercase. This is my render function render: function () { return ( <AppCanvas> <AppBar title="Crowd Invest" iconElementLeft={<IconButton> <MUI.Libs.SvgIcons.ActionAccessibility/> </IconButton>}/> <div style={{padding: '80px',}}> {this.allIcons()} </div> </AppCanvas> ); } This is the allIcons function which

React-router cannot find components of other pages in the app

大憨熊 提交于 2019-12-11 09:22:57
问题 I am trying to set up a test component, which is basically a navigation bar and two components to navigate around. This is what it looks like: class Page1 extends Component{ render(){ return (<div>Page1</div>); } } class Page2 extends Component{ render(){ return (<div>Page222</div>); } } class App extends Component{ render(){ console.log('children: ', this.props.children); return( <div> <NavigationBar/> {this.props.children} </div> ); } } ReactDOM.render( <Router history={browserHistory}>

react-tool's JSX compile a not generating JS script

让人想犯罪 __ 提交于 2019-12-11 07:55:39
问题 I am trying to convert a React.js script using the JSX syntax into a script in plain js syntax I used react-tool like recommanded in http://facebook.github.io/react/docs/tooling-integration.html#jsx But the output file simply doesnt work : no error in the browser console, nothing The script (with the JSX syntax) can be found at : http://www.youni.education/javascripts/postslist.js And you can see it working just fine at: http://www.youni.education/universities/University_of_Warwick 回答1: Two

rendering react components on click

那年仲夏 提交于 2019-12-11 04:27:00
问题 i am trying to render the Need component when we click on the "add" link. below is my code for the main component: import React from 'react'; import ReactDOM from 'react-dom'; import { Hand } from './hand.js'; import { Need } from './need.js'; class App extends React.Component{ constructor() { super(); this.processHand = this.processHand.bind(this); this.addNeed = this.addNeed.bind(this); this.state = { inhandMoney : " ", renderNeed: false, } } processHand(e){ e.preventDefault(); const

ReactJS and RequireJS -> How to use multiple classes returned from one module?

ε祈祈猫儿з 提交于 2019-12-11 02:49:36
问题 I've got a RequireJS module that returns multiple ReactJS classes that I'd like to be immediately available to the JSX scope. e.g. define(["require"], function (require) { var SimpleClass = React.createClass({displayName: 'SimpleClass', render: function() { return <div>HELLO DUDE {this.props.name}</div>; } }); var AnotherSimpleClass = React.createClass({displayName: 'AnotherSimpleClass', render: function() { return <div>SUPER DUDE {this.props.name}</div>; } }); var result = {

react.js - Deep Object in state with async data does not work

和自甴很熟 提交于 2019-12-11 02:36:28
问题 I've just figured out that object in React's state that have multiple children cannot be rendered easily. In my example I have component which speaks with third-party API through AJAX: var Component = React.createClass({ getInitialState: function () { return {data: {}}; }, loadTrackData: function () { api.getDataById(1566285, function (data) { this.setState({data: data}); }.bind(this)); }, componentDidMount: function () { this.loadTrackData(); }, render: function () { return ( <div> <h2>{this

React Native: Why isn't redux correctly updating the state?

爱⌒轻易说出口 提交于 2019-12-11 00:59:42
问题 In Redux + iOS React Native, the updated state logs properly in the parent component, but when logged inside another method, it just logs the initialState. I have the following components that call the actions: _handleFirstName(text) { this.props.actions.updateFirstName(text) } _handleLastName(text) { this.props.actions.updateLastName(text) } <TextInput placeholder='Enter First Name' onChangeText={this._handleFirstName.bind(this)} value={this.props.userInfo.firstName} /> <TextInput