For e.g. here's a module which helps with integration of Google Analytics with react:
I'm familiar with some GTA/GA React packages, but have not seen similar offerings for Adobe Analytics.
To start, I recommend a solid understanding of the AppMeasurement library. Check out the official implementation guide here. In particular, look at the initialization (steps 1-3) which you can do in your main App component, then you can call s.t() in componentDidMount or via a hook of router components.
As for the code not compiling, what error is it throwing? Are you putting the AppMeasurement.js in the public folder?