This repository was archived by the owner on Sep 6, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 6 files changed +12
-8
lines changed
Expand file tree Collapse file tree 6 files changed +12
-8
lines changed Original file line number Diff line number Diff line change 66 * otherwise it'll render a link with an onclick
77 */
88
9- import React , { PropTypes } from 'react' ;
9+ import React , { PropTypes , Children } from 'react' ;
1010
1111import styles from './styles.css' ;
1212
@@ -15,13 +15,17 @@ function Button(props) {
1515
1616 // Render an anchor tag
1717 let button = (
18- < a className = { className } href = { props . href } onClick = { props . onClick } > { props . children } </ a >
18+ < a className = { className } href = { props . href } onClick = { props . onClick } >
19+ { Children . toArray ( props . children ) }
20+ </ a >
1921 ) ;
2022
2123 // If the Button has a handleRoute prop, we want to render a button
2224 if ( props . handleRoute ) {
2325 button = (
24- < button className = { className } onClick = { props . handleRoute } > { props . children } </ button >
26+ < button className = { className } onClick = { props . handleRoute } >
27+ { Children . toArray ( props . children ) }
28+ </ button >
2529 ) ;
2630 }
2731
Original file line number Diff line number Diff line change @@ -32,7 +32,7 @@ function App(props) {
3232 < A className = { styles . logoWrapper } href = "https://twitter.com/mxstbr" >
3333 < Img className = { styles . logo } src = { Banner } alt = "react-boilerplate - Logo" />
3434 </ A >
35- { props . children }
35+ { React . Children . toArray ( props . children ) }
3636 < Footer />
3737 </ div >
3838 ) ;
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ export class LanguageProvider extends React.Component { // eslint-disable-line r
1616 render ( ) {
1717 return (
1818 < IntlProvider locale = { this . props . locale } messages = { this . props . messages [ this . props . locale ] } >
19- { this . props . children }
19+ { React . Children . only ( this . props . children ) }
2020 </ IntlProvider >
2121 ) ;
2222 }
Original file line number Diff line number Diff line change @@ -29,7 +29,7 @@ function Button(props) {
2929 return (
3030 < button className= " btn" onClick= {props .onClick }>
3131 < CheckmarkIcon / >
32- { props .children }
32+ { React . children . only ( props .children ) }
3333 < / button>
3434 );
3535}
Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ export default class App extends React.Component { // eslint-disable-line react/
2424 render ( ) {
2525 return (
2626 < div className = { styles . container } >
27- { this . props . children }
27+ { React . children . toArray ( this . props . children ) }
2828 </ div >
2929 ) ;
3030 }
Original file line number Diff line number Diff line change @@ -16,7 +16,7 @@ export class LanguageProvider extends React.Component { // eslint-disable-line r
1616 render ( ) {
1717 return (
1818 < IntlProvider locale = { this . props . locale } messages = { this . props . messages [ this . props . locale ] } >
19- { this . props . children }
19+ { React . children . only ( this . props . children ) }
2020 </ IntlProvider >
2121 ) ;
2222 }
You can’t perform that action at this time.
0 commit comments