Application.jsx
export default class App extends React.Component {
state = {
message: 'Welcome, new user! Fetching your data...',
apiKey: 'c9e2d730-4aba-42b2-9711-26ad584cba35'
};
componentDidMount() {
// Load in data using the pre-populated API key.
fetch('/api/profile', {
headers: {
'Authorization' : 'Basic ' + base64.encode(this.state.apiKey + ":")
}})
.then(loadWelcomePage);
}
render() {
return (
<div className="component-app">
<Message value={this.state.message} />
</div>
)
}
}