15 |
16 |
20 |
23 |
24 |
25 |
{this.props.title}
26 |
{this.props.description}
27 |
28 |
29 | )
30 | }
31 | });
--------------------------------------------------------------------------------
/app/js/components/QuestionForm.js:
--------------------------------------------------------------------------------
1 | var React = require('react');
2 |
3 | module.exports = React.createClass({
4 | submitHandle:function(e){
5 | e.preventDefault();
6 | if(!this.refs.title.value) return ;
7 |
8 | var newQuestion = {
9 | title:this.refs.title.value,
10 | description:this.refs.description.value,
11 | voteCount:0,
12 | };
13 |
14 | this.refs.addQuestionForm.reset();
15 |
16 | this.props.onNewQuestion( newQuestion );
17 | },
18 | render:function(){
19 | var styleObj = {
20 | display : this.props.formDisplay ? 'block':'none'
21 | };
22 | return (
23 |