I have a relatively simple problem with trying to add inline scripts to a React component. What I still have:
'use strict'; import '../../styles/pages/people.scss'; import React, { Component } from 'react'; import DocumentTitle from 'react-document-title'; import { prefix } from '../../core/util'; export default class extends Component { render() { return ( <DocumentTitle title="People"> <article className={[prefix('people'), prefix('people', 'index')].join(' ')}> <h1 className="tk-brandon-grotesque">People</h1> <script src="https://use.typekit.net/foobar.js"></script> <script dangerouslySetInnerHTML={{__html: 'try{Typekit.load({ async: true });}catch(e){}'}}></script> </article> </DocumentTitle> ); } };
I also tried:
<script src="https://use.typekit.net/foobar.js"></script> <script>try{Typekit.load({ async: true });}catch(e){}</script>
None of the approaches execute the desired script. I guess this is a simple thing that I am missing. Can anybody help?
PS: Ignore foobar, I have a real identifier that I really don't like.
javascript ecmascript-6 reactjs react-jsx
ArrayKnight Dec 22 '15 at 21:38 2015-12-22 21:38
source share