You have already heard about APIS and we need to integrate APIs with a frontend to call data from servers.
In modern react we use the useEffect hook to fetch data from API.
useEffect hook is used to fetch data, or manually changing the DOM in React components.
In the above example, we are changing in DOM after clicking on the count button by changing variable by count+1
Inside teh useEffect hook we call a function called fetch(url) with parameter of the api link we want to fetch data from
Here we are fetching articles from the local…
All are switching to modern Reactjs i.e Reactjs that works with functional components and when we work with components we need to manage the state, To manage the state we use Hook, A Hook is a special function that lets you “hook into” React features.
useState is a Hook that lets you add React state to function components. we can use useState to update the data after a particular event.
useState hook needs to be imported from react as below
It is generally used in a destructured manner where we have a current state here as count and second…
Yes, you guess it right, a function without a name is called an anonymous function. But Do you know how to use it, where to use it?
I know you are here to find these answers,
Let's Dive into it!
The anonymous function is generally used for two reasons
I know you are still not clear with anything, Let's code now with a problem in mind!!
If we want to call a function…
Reactjs is widely used for its easy making reusable components which can be used with dynamic data as well
In simple language, a component is a piece of code that can be used anywhere in the application just by writing it once and reusing it as many times as required.
Make a folder name component as given below and initialize component file name with .js extension. For example, I am using ReusableComponent.js
Note: Make a component folder inside the src folder else you will not able to call the component it will throw an error
You cannot react “haha” in react js , Just kidding! In the front-end development field react is one of the most demanding and hot tech requirement which is highly getting adapted by startups
As you can build a spa (single page application) in React you can easily switch to mobile app development later with ease.
React have a large community on Github,Reddit,Twitter and many other social media platform, errors and bugs can be easily solved here as someone has already solved it for you
As it backed by facebook the community support from Facebook developers solves almost every problem you…