File tree Expand file tree Collapse file tree 2 files changed +80
-0
lines changed Expand file tree Collapse file tree 2 files changed +80
-0
lines changed Original file line number Diff line number Diff line change
1
+ /// <reference path="react-helmet.d.ts" />
2
+ /// <reference path="../react/react.d.ts" />
3
+
4
+ import * as React from 'react' ;
5
+ import Helmet from 'react-helmet' ;
6
+
7
+ < Helmet title = "My Title" />
8
+
9
+ const head = Helmet . rewind ( ) ;
10
+ const html = `
11
+ <!doctype html>
12
+ <html>
13
+ <head>
14
+ ${ head . title . toString ( ) }
15
+ ${ head . meta . toString ( ) }
16
+ ${ head . link . toString ( ) }
17
+ </head>
18
+ <body>
19
+ <div id="content">
20
+ // React stuff here
21
+ </div>
22
+ </body>
23
+ </html>
24
+ ` ;
25
+
26
+ function HTML ( ) {
27
+ return (
28
+ < html >
29
+ < head >
30
+ { head . title . toComponent ( ) }
31
+ { head . meta . toComponent ( ) }
32
+ { head . link . toComponent ( ) }
33
+ </ head >
34
+ < body >
35
+ < div id = "content" >
36
+ // React stuff here
37
+ </ div >
38
+ </ body >
39
+ </ html >
40
+ ) ;
41
+ }
Original file line number Diff line number Diff line change
1
+ // Type definitions for react-helmet
2
+ // Project: https://github.com/nfl/react-helmet
3
+ // Definitions by: Evan Bremer <https://github.com/evanbb>
4
+ // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
5
+
6
+ /// <reference path="../react/react.d.ts" />
7
+
8
+ declare module 'react-helmet' {
9
+ import { Component } from 'react' ;
10
+
11
+ interface HelmetProps {
12
+ title ?: string ;
13
+ titleTemplate ?: string ;
14
+ base ?: any ;
15
+ link ?: Array < any > ;
16
+ meta ?: Array < any > ;
17
+ script ?: Array < any > ;
18
+ onChangeClientState ?: ( newState : any ) => void ;
19
+ }
20
+
21
+ interface HelmetData {
22
+ title : HelmetDatum ;
23
+ base : HelmetDatum ;
24
+ link : HelmetDatum ;
25
+ meta : HelmetDatum ;
26
+ script : HelmetDatum ;
27
+ }
28
+
29
+ interface HelmetDatum {
30
+ toString ( ) : string ;
31
+ toComponent ( ) : Component < any , any > ;
32
+ }
33
+
34
+ class Helmet extends Component < HelmetProps , any > {
35
+ static rewind ( ) : HelmetData
36
+ }
37
+
38
+ export default Helmet ;
39
+ }
You can’t perform that action at this time.
0 commit comments