Posts

Showing posts from January, 2022

How to use Radium in React for inline styling?

  Pseudo selectors and media queries are generally used for inline styling. So, in this article, we will see  how to use Radium in React for inline styling. Radium  is a popular npm package for React which allows users to use inline styling with pseudo selectors and media queries. Without this third-party package, users can not do inline styling with pseudo selectors. This is because React doesn’t allow users to use pseudo-selectors in inline styling. Examples of pseudo-selectors are hover, visited, link, etc. Example: So, here is an example of styling a button having a hover(pseudo selector) effect. Step 1:  Make a new folder for the project. Step 2:  Now in your terminal, run the following command from the root of your project folder for installing create-react-app and saving it globally. $ npm install create-react-app -g Step 3:  Now create a sample react app using the command in your terminal. Name it my-app. $ create-react-app my-app Step 4:  You ...

What is the Navbar Component in ReactJS?

Image
Reactstrap is a bootstrap-based react UI library that is used to make good-looking web pages. So, in this article, we will see  what is the Navbar Component in ReactJS. Reactstrap library contains the stateless React components for Bootstrap 4.  So, the Navbar component provides a way for users to provide them navigation controls at the top of an application. Below we have listed the properties of the Navbar component. Also, we have provided the sample program to show the implementation of the Navbar Component. Navbar Props: light:  You can use this prop to indicate whether to apply the light color class to it or not. dark:  You can use this prop to indicate whether to apply the dark color class to it or not. fixed:  You can use this prop to indicate whether to apply position fixed property or not. color:  You can use this prop to denote the color for this component. role:  You can use this prop to denote the value for role property...

What is a compound component in ReactJS?

  Compound components are a pattern that encloses the state and the behavior of a group of components. But it still gives the rendering control of its variable parts back to the external user. So, in this article, we will see  what is a compound component is in ReactJS. Compound components help developers build more expressive and flexible APIs to share state and logic within components. The objective of compound components is to provide a more expressive and flexible API. This will help ing communication between the parent and the child components. Think of it like the  <select>  and  <option>  tags in HTML: <select> <option value="volvo">Volvo</option> <option value="mercedes">Mercedes</option> <option value="audi">Audi</option> </select> The  select  tag works together with the  option  tag. It is used for a drop-down menu to select items in HTML. Here the  <sel...