Application.jsx
export default class App extends React.Component {
state = {
message: 'Welcome, new user! Fetching your data...',
apiKey: '{{INSERT_API_KEY_HERE}}'
};
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>
)
}
}