The Only React JS Tutorial You'll Ever Need
Hello guys , I am Garry Raut ' Machine learner , deep learner and developer ' . To day we will learn all about the react js.
What is React?
React is an open source library of views, animations, components. The component pattern allows you to develop advanced, dynamic, single-page applications. What are the components? A component is an object that is able to handle all its own business logic and render a HTML document. What are the elements? The elements is an object that has two properties. Names : This is an optional property. You can use a name for example gormans bar to name our tests. This is very useful, a name of an unknown test. However this name may be found at runtime. Let's start by writing the boilerplate for the hello world test. Hello world ( bad ) So let's create some more test cases. The createTests method is what creates the test. reactDemo.createTests() 2.
React vs jQuery
Some people might say that React JS is just another jQuery or MooTools so let's start with this article by separating these two terms. The difference between React JS and jQuery is that jQuery & MooTools js are Javascript while React JS js is "A.B.C Javascript" Are you sure you want to do it? D'uh? Oh it is very simple that these two concepts are independent. If you want to read how to become a JavaScript developer you can choose one of the classes that JavaScript provides to improve your skills : reactjs - this is the official "A.B.C Javascript" for learning. - this is the official "A.B.C Javascript" for learning. udemyjs - this class covers the most important areas of the front-end development.
Setting Up React
Lets start from here : https://js.react-api.com/api/react-data/ Now if we visit http://localhost:4000/react-data we see following page : I highly recommend you to add all the resources using npm and then npm start . Now we see the page about the command : http://localhost:4001/react-command To run the CLI we will use following command : npm start Now we can see the command under the container : react-command What's the command? Is it ready to use ? It's not ready for use yet, I am going to show you later the react-command CLI. Let's continue with the example ! Getting access to the Lambda function Lets go through the code : https://github.com/JenaAW/react-quick-start-with-reactjs. Lets say we want to do CRUD with the tables and we want to have a custom route !
Tools You'll Need
basic knowledge of javascript a react and a react-router projects reactjs react-router a basic understanding of reactive programming nodejs And a google-fu Hello World I want to make you aware that the topic i am going to discuss is very technical. But to achieve great results i must be very focussed and clear about the core concepts of the whole topic, otherwise i will be building a shadow of the actual topic. Here is the small hello world example As you can see it is very basic, but it does contains some important elements that are needed in any complex app. Hello world application using react and react-router For the demo i am using a google chrome emulator and moo.js but you can try on your browser of choice.
Setting Up Your React Component
We will be using the react-addons-introspection to set up our own components. To do this I suggest you read up the introspection docs. I will be using express-form, react-native-toolkit-react and react-native-retrofit. Install React JS This is the most straight forward thing to do and you have a couple of options: The easiest is npm install -g react For the last few releases npm has been pretty stable. With that said the thing that tends to break is Firefox. Install react-addons-introspection The easiest way is the command line or using a package.json file. npm install -g react-addons-introspection Introspection So this is what is getting us to the point. I encourage you to read through the introspection docs. It's a big rabbit hole and will get deep.
React Lifecycle Methods
The first thing to understand is how react works . React is a react react is an React is a JavaScript library that brings the component system to the JavaScript community. It enables creating simple static and dynamic UI. React is a React is a JavaScript library that brings the component system to the JavaScript community. It enables creating simple static and dynamic UI. To learn more about it, you can read the React project page . Once you have the React knowledge , let's go ahead and learn more about the react lifecycle methods. The ReactJS Components A Component is basically a script which returns an element To put it into simple words You can write a component like the below class SignUpComponent extends React.
JSX
JSX (jsx) is a way to create React code. It works similar to HTML . You will create single line JSX code inside JSX tags and apply JavaScript transformations before and after these JSX tags. We have to make a note that we cannot use new JSX tag when calling methods .
JSX tag: > =) →
We will see this in action with Our
React Example Code:
reactReactRouter = function ()
{ return { getNoInApp: function (req, res) { return res.json(req.query) } } }
reactComponent = function ()
{ return
{reactReactRouter()}
}
React Router If you have not ever used React Router then, then you will understand it with this example code. As you can see we have a route / that returns “No InApp” if there is not a page.
Events
Event using react can be easily implemented and made interactive in a form like an IRC ( I know :) ) So as you know I was working on a website like a IRC so I came up with this idea. Let's use it in JSX export default class MyPage extends React.Component
{ render() { return
Hello from React
} }
This will make the whole thing explode... But hey , I was planning to do it like that :P So in the browser you will see
document.body.appendChild(document.createElement('li'),
window.addEventListener('load', function()
{ console.log(window.attrName); });
Now when the moment comes we can try to add some content. console.log(window.readyState) { }
This is due to a bug in JSX :( .
Props vs State
What is the difference between props and state? In this tutorial I am going to cover all this in detail. Below is a definition: Props You know how normal code looks like? It goes like this,
reactDOM.render(, document.getElementById("app"));
State You know how JS code looks like?
ReactDOM.render(, document.getElementById("app"));
There is a slight difference between them. State is like extra data stored in the DOM. For example, let's say we create a directive called Click. It can be a click handler that fire an action when a user clicks the button. Also, there are thousands of directives. We will create a few using few core directives but none with more than 2 directives. State is like extra data stored in the DOM.
If You're Using React, You Probably Need Redux
Hello , I am Garry Raut , Machine learner , deep learner and developer ' . React is a JavaScript library developed by Facebook that allows developers to build user interfaces for web and mobile devices, and most importantly provide component that act as the building blocks of UI. A component is a piece of functionality that is composable, reusable, and programmable. Think of it as a reusable component react is a huge library with lots of functionality, so if you want to know everything there is to know about it, you will have to learn at least its core concepts, in order to achieve good understanding. One of the key features of the react library is its UI reusability concept, and in my opinion this is one of the most important feature of the library.
Comments
Post a Comment