-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcodeToAdd.js
62 lines (44 loc) · 1.27 KB
/
codeToAdd.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
// App initial route - middleware:
import {renderToString} from "react-dom/server";
let html;
try {
html = renderToString(<App/>);
} catch (e) {
console.log(e)
}
res.send(renderToString(<Index html={html}/>));
};
//App initial step (React route)
import React from "react";
<h1 className="header item">All Things Westies</h1>
<a href="/products" className="item">Products</a>
<a href="/cart" className="item">Cart</a>
<a href="/profile" className="item">Profile</a>
//To add redux
// static loadData(params, store, request = {}) {
// return [
// parseUserAgent.bind(null, request.headers),
// storeUserId.bind(null, request.headers)
// ];
// }
//To add react router - in app
<h1 className="header item">All Things Westies</h1>
<Link to="/products" className="item">Products</Link>
<Link to="/cart" className="item">Cart</Link>
<Link to="/profile" className="item">Profile</Link>
<div>My first component</div>
{
React.Children.map(
this.props.children,
(child) => {
return React.cloneElement(
child,
{ router: this.props.router }
);
}
)
}
//advanced stuff - adding a banner
<Banner show>
<h3>Check out the semi-annual sale! Up to 75% off select Items</h3>
</Banner>