Adding script tag to React/JSX

后端 未结 17 1234
感动是毒
感动是毒 2020-11-22 03:52

I have a relatively straightforward issue of trying to add inline scripting to a React component. What I have so far:

\'use strict\';

import \'../../styles/         


        
17条回答
  •  面向向阳花
    2020-11-22 04:31

    My favorite way is to use React Helmet – it's a component that allows for easy manipulation of the document head in a way you're probably already used to.

    e.g.

    import React from "react";
    import {Helmet} from "react-helmet";
    
    class Application extends React.Component {
      render () {
        return (
            
    ...
    ); } };

    https://github.com/nfl/react-helmet

提交回复
热议问题