Hey all! This lesson today will be quite important to us. We’ve come closely to Redux, but first let us look through our home task. Though it was pretty simple, but let me show you how to add our calendar. Install our module: npm install react-day-picker —s Make sure there is a record on this event in our package.json:
We will further refer to the http module quite often, so let us now explore its supporting materials, what we can find there and where. Right now the http module combines two functional services. The first one is the server functionality. http.createServer creates a new object of a Server class. If a handler is transmitted, it will go to the request event. The second functional service is createClient.
Hey all! This lesson will be devoted to the echo server creation. This is a server that brings up the parameter meaning upon the url/echo request with the message parameter: // http://127.0.0.1:3000/echo?message=Hello -> Hello The answer to all other requests will be: Page Not Found. Let us start from a template of this kind:
Hey all! This time we will meet Node.js as a web server. So, let us create a new app for that purpose. Set up your editor in a way it would know you’re working on a Node.js project and support the respective auto-additions and global variables. Next let us create server.js and connect a module as the very first step:
Let us continue our conversation about React infrastructure. But first, let us change our structure a little bit and move our Article component to a separate directory Article. So, let us create it. Change our component’s name to Index.js and add the following code:
To check out our structure we need to use React dev tools. You can download them here. This enables us to monitor the whole structure of your Virtual DOM, your components and third-party components. Also it has data access, you can view their Props, State, etc. It gets installed as an expansion to your browser and will be accessible when you request developing tools. As you begin working with React or a new project it is extremely useful.
Let's talk about our homework. It is worth noting that the development of decorators / mixins all logic in most cases work perfectly. It was implemented by us in the class, for homework was to make it to the decorator and the corresponding mixin. So it will look like our decorator:
The next object we are interested in is EventEmitter, or, as it is sometimes called, EE. EventEmitter is a basic object that executes work with events in Node.js. A great number of other built-in objects generating events inherit from it. To use EventEmitter you only need to connect the built-in “events” module and take a respective property from it (let us create ee.js);