Created
March 22, 2017 15:43
Typescript component using react-intl
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
import * as React from "react"; | |
import SelectField from "material-ui/SelectField"; | |
import { intlShape, injectIntl, FormattedMessage, InjectedIntlProps } from "react-intl"; | |
interface IExampleProps { | |
// ... | |
} | |
class ExampleComponentWrapped extends React.Component<IExampleProps & InjectedIntlProps, {}> { | |
static propTypes: React.ValidationMap<any> = { | |
intl: intlShape.isRequired | |
}; | |
public render(): JSX.Element { | |
return ( | |
<SelectField floatingLabelText={this.props.intl.formatMessage({id: "hello_world"})} /> | |
); | |
} | |
} | |
const ExampleComponent = injectIntl(ExampleComponentWrapped); | |
export default ExampleComponent; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks!