Skip to content

Instantly share code, notes, and snippets.

@fivethreeo
Last active September 15, 2021 19:46
Show Gist options
  • Save fivethreeo/24ed8f61d5d04550226ed7800493e80a to your computer and use it in GitHub Desktop.
Save fivethreeo/24ed8f61d5d04550226ed7800493e80a to your computer and use it in GitHub Desktop.
import React from 'react';
import logo from './react.svg';
import './Home.css';
import { Helmet} from 'react-helmet-async';
import axios from 'axios';
class Home extends React.Component {
my_title = 'sss'
constructor(props) {
super(props);
this.state = { title: '' };
}
componentDidMount() {
const promise = axios.get('https://jsonplaceholder.typicode.com/todos/1').then(()=>{
this.setState({title: 'My app title'});
});
if (typeof window === 'undefined') {
throw promise;
};
}
render() {
return (
<div className="Home">
<Helmet prioritizeSeoTags>
<meta property="og:title" content={this.my_title}/>
</Helmet>
<div className="Home-header">
<img src={logo} className="Home-logo" alt="logo" />
<h2>Welcome to Razzle</h2>
</div>
<p className="Home-intro">
To get started, edit <code>src/App.js</code> or
<code>src/Home.js</code> and save to reload.
</p>
<ul className="Home-resources">
<li>
<a href="https://github.com/jaredpalmer/razzle">Docs</a>
</li>
<li>
<a href="https://github.com/jaredpalmer/razzle/issues">Issues</a>
</li>
<li>
<a href="https://palmer.chat">Community Slack</a>
</li>
</ul>
</div>
);
}
}
export default Home;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment