How to get IP address in Angular, React, VueJS, frontend Framework?

How to get IP address in Angular, React, VueJS, frontend Framework?

The TLDR answer:

Using a third-party service is the best option possible according to me. One service which I have been using for years is https://jsonip.com. It hasn't let me down until now.

Here are the code snippets you can use as per your framework:

// If you are using angular

this.http.get('https://jsonip.com/').subscribe(data => {
    console.log(data);
});

// For React use axios or fetch API.
fetch("https://jsonip.com/").then(
    res => console.log(res.json())
)