Question: I'm trying to make a simple navbar, where some of the links link to sections in the same component(page), using react scroll and then have other links link to a different component(route page). Hope the makes sense?

Here is a simple version: <https://codesandbox.io/s/late-firefly-x109rk>

In this example I have four links. The idea is to have Home, About and Contact scroll to the corresponding section and have new page open a new page using the Router.

There are currently two problems with this example:

1: if Home, About or Contact is active when going to the new page they stay active, while the new page also gets active.

2: When trying to go back from NewPage to Home, About or Contact I get "target Element not found"

Answer: 
Delete it and start over. Why wonder if you've found everything the cybercreep left behind? And don't enable access except from an allow-list of known IPV4 and IPV6 addresses.

Many database ops people choose never to expose their databases to the public net, and now you know why.
Just turning all the 'trust' to 'md5' and rebooting the OS might be good enough, but there is no way to tell that based on this info. If there is nothing important on the server, just burn it down and rebuild it.

In addition to not using trust, additional simple steps would be to make sure your password is actually good, not allowing non-local connections for the 'postgres' user (or any other superuser), or not allowing non-local connections at all if not necessary or whitelisting connections from specific IP addresses if you do need to allow them.