React – Howto redirect to other component

Sometimes, for example on a login, you want to redirect the User to another page in your application.

We assume that your Application has the default address of http://localhost:3000.

In this example, the application has the path localhost:3000 and you can navigate to the news with /news.

import {Redirect} from "react-router-dom";
//... your program code goes here...

   <Redirect to='news'/>

The return statement will redirect to localhost:3000/news

How to debug a React Application in Webstorm

In Webstorm, start your application. I prefer the command line:
$ npm start

Then create a new JavaScript debug configuration:

Run – Edit configurations … add JavaScript Debug.

Choose your project path (because we are Harder IT Consulting, our nickname is HIT – C:\HIT\<application>)

Paste the URL http://localhost:3000 (or the URL you have configured your React Application to run on, 3000 is the default).

Press the DEBUG button at the top right corner with your Debug configuration selected.

How to make Virtualbox available on Windows (Forwarding)

Taken from our Archives:

Sometimes fate forces us to work with Windows.
Because Linux is so good, we get a VirtualBox to emulate it.

How can we access a webapplication via localhost:8080 from the Windows machine inside of a Webbrowser?

VirtualBox Manager -> VM-Tools -> Settings -> Network -> Port Forwarding

Name: http8080 
Protocol: TCP
HostIP: empty
Host-Port: 8080
Guest-IP: empty
Guest-Port: 8080

Name: ssh 
Protocol: TCP
Host-Port: 2222
Guest-IP: empty
Guest-Port: 22