Tag: ReactJS

  • How to create a custom tab in React?

    How to create a custom tab in React?

    Creating custom tabs in ReactJS involves building a component that manages the active tab state and renders the appropriate content based on the selected tab. Here’s how you can create custom tabs step by step: Step 1: Set Up Your Project Make sure you have a React project set up. You can use Create React…

  • How to use React 18 image lightbox?

    How to use React 18 image lightbox?

    react-18-image-lightbox is a library that provides a customizable lightbox component for displaying images. Here are the steps to use react-18-image-lightbox in your React project: 1. Install the library using npm or yarn: npm install react-18-image-lightbox // or yarn add react-18-image-lightbox 2. Import the Lightbox component and any other dependencies you may need, such as images…

  • How to create back to top button with React JS?

    How to create back to top button with React JS?

    Create the back to top button with React JS easily. Create a component GoTop.js import React from ‘react’; const GoTop = ({scrollStepInPx, delayInMs}) => { const [thePosition, setThePosition] = React.useState(false); const timeoutRef = React.useRef(null); React.useEffect(() => { document.addEventListener(“scroll”, () => { if (window.scrollY > 170) { setThePosition(true) } else { setThePosition(false); } }); }, [])…

  • How To Customize React Tabs?

    How To Customize React Tabs?

    An accessible and easy tab component for ReactJS! Step 1: Install the package npm install react-tabs Step 2: then create the component import { Tab, Tabs, TabList, TabPanel } from ‘react-tabs’; import ‘react-tabs/style/react-tabs.css’; const ReactTabs = () => { return ( <> <Tabs> <TabList> <Tab>Title 1</Tab> <Tab>Title 2</Tab> </TabList> <TabPanel> <h2>Any content 1</h2> </TabPanel> <TabPanel>…