React Components | What is Component in React Js | Importance of Components in Application
Hello & As-salam u alikum ! This is the second article related to React js , In this blog we will discuss the introduction and importance of Components.
The Programmers used to write a lot of code in earlier days to create application ,In which many of the code was much repetitive ,assume that there is one functionality which is present on page-1 ,page-2 ,page-3 & pages-4 ,we use to copy and paste the code on each page, when ever any change was required,we need to change the code on every page or view, That was very difficult task for developer for manage such code.
React js came to resolve this problem with component base class code. In which we do not have to write the code again and again ,we just make a single unit of generic code once then we use the same component every where on application.
The Programmers used to write a lot of code in earlier days to create application ,In which many of the code was much repetitive ,assume that there is one functionality which is present on page-1 ,page-2 ,page-3 & pages-4 ,we use to copy and paste the code on each page, when ever any change was required,we need to change the code on every page or view, That was very difficult task for developer for manage such code.
React js came to resolve this problem with component base class code. In which we do not have to write the code again and again ,we just make a single unit of generic code once then we use the same component every where on application.
Types of Components:
React js have two types of components
- Functional
- Class
Functional Components:function components are a way to write components that only contain a render method and don't have their own state. They are simply JavaScript functions that may or may not receive data as parameters. We can create a function that takes props(properties) as input and returns what should be rendered. A valid functional component can be shown in the below example.Example |
Class Components:
Class components are more complex than functional components. It requires you to extend from React. Component and create a render function which returns a React element. You can pass data from one class to other class components. You can create a class by defining a class that extends Component and has a render function.
2 Comments:
Thanks for sharing your innovative ideas to our vision. I have read your blog and I gathered some new information through your blog. Your blog is really very informative and unique. Keep posting like this. Awaiting for your further update.If you are looking for Angular Applications In Australia, .Net Core Applications In New Zealand, IOT Applications In Singapore and .Net Applications In UAE information please visit our website Sidhyati Technology Solutions Pvt Ltd
Thanks for sharing this blog.This article gives lot of information.
Mern stack online training
Mern stack training in hyderabad
Post a Comment
Do not Add Spam links in the Comment Box
Subscribe to Post Comments [Atom]
<< Home