How to use model-Viewer in React?

Asked

Viewed 53 times

-1

1 answer

1

Hello, I tbm was with that same problem!

I followed this tutorial using lib React Helmet.

First of all, you install lib via npm with the command:

npm install --save react-helmet

After that, go to the page on which you want to apply the model-Viewer and import the lib:

import Helmet from 'react-helmet'

Once that’s done, all we need to do is put this guy inside the render method’s Return in the middle of our component by passing an attribute to apply. In our case, it is the Viewer model script:

<Helmet>
   <script type="module" src="https://unpkg.com/@google/model-viewer/dist/model-viewer.min.js"></script>
</Helmet>

I hope the post helps you in your projects somehow and any questions you have just contact me.

Instagram: @joaomiiiguel

Browser other questions tagged

You are not signed in. Login or sign up in order to post.