Last active
April 3, 2018 22:51
-
-
Save micahgodbolt/86c19fe870ff477af7fe0432c500dcac to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Content extends React.Component { | |
constructor() { | |
super(); | |
} | |
render() { | |
return ( | |
<Fabric className='foo'> | |
<DefaultButton | |
onClick= {() => alert('hello')} | |
onRenderText= {this._onRenderText} | |
text="Hi There" | |
foo="Foo" | |
/> | |
</Fabric> | |
); | |
} | |
private _onRenderText:IButtonProps['onRenderText'] = (props, defaultRender) => { | |
return ( | |
<span> {defaultRender()} {props.foo} </span> | |
); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Content extends React.Component { | |
constructor() { | |
super(); | |
} | |
render() { | |
return ( | |
<Fabric className='foo'> | |
<DefaultButton | |
onClick= {() => alert('hello')} | |
onRenderText= {this._onRenderText} | |
text="Hi There" | |
foo="Foo" | |
/> | |
</Fabric> | |
); | |
} | |
private _onRenderText:IRenderFunction<IButtonProps> = (props, defaultRender) => { | |
return ( | |
<span> {defaultRender()} {props.foo} </span> | |
); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
From https://twitter.com/nickytonline/status/981301072697360390
I'm sure there's more to your class, but if it's something simple like this, it could just be a
React.SFC<IButtonProps>
and_onRenderText
could be a utility function since it does not usethis
.