CLI – helps to create the package with JS/TS, build system(Webpack/Parcel) and necessary stuff 🔥
It’s like create-react-app but for building packages 📦
In My Previous post Style React component with styled-components : Part-1 , I wrote how we can start using
styled-components and we created one Spinner component with it.
Now we can see, how we can pass props to the styled component named
StyledSpinner and change the color/behavior of it.
For this example, I will change the border color by passing prop. So, the styled component will show the color what we pass to it. Continue reading
Sometimes we need to serve static HTML files in localhost. And we really don’t want to add any server for a simple HTML file.
Generally, we can right click on the HTML file and can say “open in browser” and it will open the file in your local browser(Chrome, Firefox, Edge, Safari) but it’s actually not exactly what we always want. rather we want something like a simple web server to serve the files from a directory.
Styling your React component is an important part for any real world application.
We can style react components in a couple of ways. such as –
1. inline styling
2. CSS modules
We will talk about styled-components in this article.
We are gonna create one simple animated loading spinner component.
When we need to use third party API or any REST API in our web app, we need to wait for the response coming from the server.
Then in the success callback , we use that data and do other operations.And if we have more REST calls, we all know that it could end up being a Callback Hell
But if we use ES2017 async/await syntax , we can write our code as clean as possible with minimum lines of code.
Basic example of async/await is like below-