Creating your first ReactJS client
ReactJS is a declarative JavaScript library that helps in building user interfaces efficiently. Because it works on the concept of virtual DOM it improves application performance, since JavaScript virtual DOM is faster than the regular DOM.
In this recipe, we will learn to create a ReactJS client to send a POST
request to the HTTP server running locally.
Getting ready…
As we have already created an HTTP server that accepts both GET
and POST
HTTP requests in our previous recipe, we will be using the same code base as our HTTP server.
Also, this recipe assumes you have npm
installed on your machine and you have basic knowledge of npm
and webpack
, which is a JavaScript Module bundler.
Note
See the Creating your first HTTP POST method recipe.
How to do it…
- Create a
reactjs-client
directory where we will keep all our ReactJS source files and an HTTP server, as follows:
$ mkdir reactjs-client && cd reactjs-client && touch server.go
- Copy the following code...