2016-07-23 13 views

答えて

3

ここにDocがあります。基本的に、Buttonコンポーネントを作成すると、デフォルトでbutton html要素としてレンダリングされます。 「カスタムコンポーネント」内にラップさせたい場合は、たとえば<span>のようにcomponentClassプロパティを使用して処理することができます。

例:Buttonデフォルトbutton要素とspanCustomButtonとしてレンダリングされる。この場合

var Button = React.createClass({ 

    render() { 
     return <h1 ref='button_node'> 
     <ReactBootstrap.Button bsStyle="success">Button</ReactBootstrap.Button> 
     </h1>; 
    } 
    }); 

    var CustomButton = React.createClass({ 

    render() { 
     return <h1 ref='button_node'> 
     <ReactBootstrap.Button componentClass="span" bsStyle="danger">Custom one</ReactBootstrap.Button> 
     </h1>; 
    } 
    }); 

    ReactDOM.render(<Button/>, document.getElementById('button')); 
    ReactDOM.render(<CustomButton/>, document.getElementById('custom-button')); 

関連する問題