skip to Main Content

I have given a

tag from a software company that makes online reservation for restaurants.
normally you just paste the script tag in a wordpress article. But now i build my website with vite-React and after reloading, the Button for reservation disappears.

How would i fix that are there ways to rerender the Button ?

2

Answers


  1. You can try putting it in a main component. if this doesn’t resolve please share you code over here which will be more helpful to resolve it efficiently

    Login or Signup to reply.
  2. To achieve more control and maintainability, we can use the react-helmet library. Install it using npm:

    npm install react-helmet

    Now, let’s create a React component that utilizes React Helmet

    import { Helmet } from 'react-helmet';
    
    function ScriptRenderer() {
      return (
        <div>
          <Helmet>
            <script>
              {`
                console.log('This script runs all the time with React Helmet!');
              `}
            </script>
          </Helmet>
        </div>
      );
    }
    
    export default ScriptRenderer;
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search