react-jsx

Reactjs: setState with checkbox: checked or unchecked

拟墨画扇 提交于 2019-12-14 04:17:48
问题 I'm currently "testing the waters" with Reactjs. Based on their docs, I have whipped up a small project that I'm stuck with. So far, when the checkbox is checked, the state changes but....not sure how to change a state unchecked: var Foo = React.createClass{( getInitialState: function() { return { location: true, } }, onClick: function() { this.setState({ location: false }); }, render: function() { var inlineStyles = { display: this.state.location ? 'block' : 'none' }; return ( <div> <input

ReactJS + React Router: How to reference a specific object to pass down as properties?

吃可爱长大的小学妹 提交于 2019-12-14 03:46:03
问题 I currently have a table and each cell has a button. Upon clicking the button, based on that particular day (Monday or Tuesday), class (class 1 or class 2), and name (Kev or Josh), how can I push an object related to that particular button in the table to a new page? Using, ReactJS + React Router, what would be the correct approach to this? And when once navigated to the new page, the new page would then populate a table with the class information from the object passed in, related to button

React not passing along properties when rendering in variable

谁都会走 提交于 2019-12-13 17:56:37
问题 I'm writing a reusable component for menu itens, but React is not passing along the properties to the HTML when I render it in a variable. I'm using Browserify with the reactify tranform. Here is the component code: var React = require('react'); var ReactPropTypes = React.PropTypes; var Menu = React.createClass({ propTypes: { route: React.PropTypes.string, key: React.PropTypes.string.isRequired }, render: function() { //alert(this.props.route); var routeName = this.props.route; var content =

Why doesn't <Table/> show the check box when rendered multiple times?

亡梦爱人 提交于 2019-12-13 17:21:22
问题 I am using <Table/> from http://www.material-ui.com/#/components/table . When I render the <TableRowColumn/> multiple times depending on how many objects are in the array, the checkboxes do not appear. For example, if there are two objects, it renders two rows, but the checkboxes don't show. What may be the issue? COMPLETELY NEW EDIT So the FileTable.js is rendered on another page, and it is triggered to be made by a button inside an index route Home.js . render( <div> <Provider store={store}

Splitting React components into separate files

我与影子孤独终老i 提交于 2019-12-13 14:27:43
问题 This seems to be a common question, I'm finding a lot of people asking it and the responses are all very different and seem to be a bit hit and miss. I've watched various video tutorials, read plenty of tutorials, and the documentation. But alas it seems React is moving faster than the writers can keep up with. Or I'm just misunderstanding. I want to create each component in a separate file, where logical to do so. I have React working, but am unable to work out how to import and use

why to import React

╄→尐↘猪︶ㄣ 提交于 2019-12-13 12:25:01
问题 I have code which works only after importing React but I'm not using React anywhere I'm using reactDom instead import ReactDOM from 'react-dom' import React, {Component} from 'react' class App extends Component { render () { return ( <div>comp </div> ) } } //ReactDOM.render(<App/>, document.getElementById('root')) ReactDOM.render(<div>sv</div>, document.getElementById('root')) why its require to import React ?? 回答1: Although you don't explicitly use the React instance you've imported, JSX is

Sending row/cell data on click to the function - ReactJS

偶尔善良 提交于 2019-12-13 02:26:51
问题 I am retrieving table data from componentWillMount and showing it as UI. I want to trigger a fuction when the row/cell is clicked and return that value back to another PHP so that i can query the backend using that retrieved cell value. index = 0,1,2,3 ( I have 4 columns ) row = data for each index. I am not sure why this.state.testTime is not sending the correct value to handleClick function. Does anyone have any inputs on this? Thanks. _handleClick: function (event) { this.setState(

How do I add custom font in React Native not using Xcode?

一曲冷凌霜 提交于 2019-12-12 20:15:07
问题 Is there a way to add custom font in React Native in Atom editor and not using Xcode? 回答1: There is an easier way of doing things through command line using rnpm . It adds fonts to both android and ios. Place the font you want to add to a suitable location inside your project directory. In your package.json just add the following: ... "rnpm": { "assets": ["path/to/your/font/directory"] }, ... Then from command line do: rnpm link you can now happily use your fonts in your app. Note: you have

Material-UI LinearProgress bar not working

ε祈祈猫儿з 提交于 2019-12-12 19:25:31
问题 I have a simple file upload utility, for which I am using react-dropzone, and in conjunction to that I wanted to use material-ui LinearProgress bar to show the progress. Shown below is the component I created which renders the file upload utility along with the LinearProgress bar. I am using superagent library for the actual upload of the back to the backend using multipart formdata. The superagent's request allows a callback or an event handler for upload progress. In my code, the progress

React using react component inside of dangerouslySetInnerHTML

淺唱寂寞╮ 提交于 2019-12-12 17:54:59
问题 I have a question about using react. As you can see from the title, I'm wondering if it is possible to use React component(that is created by React.createClass) inside of "dangerouslySetInnerHTML" property. I have tried, but React just prints code without transformation like this: const MySubComponent = React.createClass({ render() { return (<p>MySubComponent</p>); } }); ... let myStringHTML; myStringHTML += "<ul>"; myStringHTML += " <li>"; myStringHTML += " <MySubComponent />"; myStringHTML