How to create sub-domain of any domain in react?

I want to create multiple sub-domain according user sign-up for eg:-
I have a domain :- http://xyz.com
If John is register in that web site, then I want to create a sub-domain :- http://john.xyz.com.

Please advice me any solution.

As far as i know, react is not involved in anything with this.
This is a DNS issue, probably something like DNSMadeEasy and their API should fit your need.