File tree 3 files changed +42
-15
lines changed
3 files changed +42
-15
lines changed Original file line number Diff line number Diff line change @@ -89,8 +89,9 @@ Only views can be SSR. Views are components that directly connected to a URL. To
89
89
90
90
```
91
91
Component.propTypes = {
92
- initialSSRData: PropTypes.shape({
93
- posts: PropTypes.array(),
92
+ initialSSRData: PropTypes.shape({
93
+ posts: PropTypes.array(),
94
+ }),
94
95
};
95
96
96
97
export default Component;
Original file line number Diff line number Diff line change 1
- import React from 'react' ;
1
+ import React , { Component } from 'react' ;
2
+ import PropTypes from 'prop-types' ;
2
3
import MetaTags from 'react-helmet' ;
3
4
4
5
import logo from 'src/assets/logo.svg' ;
5
6
7
+ import { getHomeTitle } from './requests' ;
8
+
6
9
import './Home.scss' ;
7
10
8
- function Home ( ) {
9
- return (
10
- < main className = "container home" >
11
- < MetaTags title = "divar-starter-kit 🚀" />
12
- < img
13
- className = "home__logo"
14
- src = { logo }
15
- alt = "divar-stater-kit"
16
- />
17
- < p className = "title" > Running divar-starter-kit successfully.</ p >
18
- </ main >
19
- ) ;
11
+ class Home extends Component {
12
+ static serverSideInitial ( ) {
13
+ const title = getHomeTitle ( ) ;
14
+
15
+ return {
16
+ title,
17
+ } ;
18
+ }
19
+
20
+ render ( ) {
21
+ const { initialSSRData : { title } } = this . props ;
22
+
23
+ return (
24
+ < main className = "container home" >
25
+ < MetaTags title = "divar-starter-kit 🚀" />
26
+ < img
27
+ className = "home__logo"
28
+ src = { logo }
29
+ alt = "divar-stater-kit"
30
+ />
31
+ < p className = "title" > { title } </ p >
32
+ </ main >
33
+ ) ;
34
+ }
20
35
}
21
36
37
+ Home . propTypes = {
38
+ initialSSRData : PropTypes . shape ( {
39
+ title : PropTypes . string ,
40
+ } ) . isRequired ,
41
+ } ;
42
+
22
43
export default Home ;
Original file line number Diff line number Diff line change
1
+
2
+ // eslint-disable-next-line import/prefer-default-export
3
+ export function getHomeTitle ( ) {
4
+ return 'Running divar-starter-kit successfully.' ;
5
+ }
You can’t perform that action at this time.
0 commit comments