Apologies if this is very basic as I am a complete react beginner, I'm asking this question here as I have no idea where to start to get this working.
Im trying to convert this raw html code into a react app.
<body>
<div style="width: 600px; height: 400px;" id="aww-wrapper">
</div>
<script src="https://awwapp.com/static/widget/js/aww3.min.js">
</script>
<script type="text/javascript">
var aww = new AwwBoard('#aww-wrapper', {
});
</script>
</body>
This code creates a small whiteboard app on the webpage.
I have tried to implement it into the app component in react but am having trouble getting the 'var aww = ...' script to work.
import React from 'react';
import './App.css';
import ScriptTag from 'react-script-tag'
function App() {
return (
<div className="App">
<div style={{width:'600px', height:'400px'}} id="aww-wrapper">
</div>
<ScriptTag src="https://awwapp.com/static/widget/js/aww3.min.js" />
<ScriptTag type="text/javascript">
var aww = new AwwBoard('#aww-wrapper', {
});
</ScriptTag>
</div>
);
}
export default App;
I am using scripttag to get the external javascript onto the web page, but it isnt working for the 'var aww = ...' part.
It would be a huge help if anyone has a general direction that they can direct me to in order to implement the javascript into the react code.
{var aww = new AwwBoard('#aww-wrapper', { });}ScriptTag. Create a new js file and put all you AwwBoard code in that. And use<Script src="./aww.js" />