Sunday, October 5, 2025
HomeLanguagesReact Suite Dropdown Used with next/link

React Suite Dropdown Used with next/link

React Suite is a front-end library designed for the middle platform and back-end products. The React Suite Dropdown component allows navigating with a number of options to select from a dropdown. React Suite Dropdown Used with next/link helps to wrap the items in the dropdown into hyperlinks.

Syntax:

<Dropdown.Item as={} href="" />

Prerequisite:

Creating React Application and Module installation:

Step 1: Create the react project folder, for that open the terminal and write the command npm create-react-app folder name. If you have already installed create-react-app globally. If you haven’t, install create-react-app globally using the command npm -g create-react-app or install locally by npm i create-react-app.

npm create-react-app project

Step 2: After creating your project folder(i.e. project), move to it by using the following command.

cd project

Step 3:  now install the dependency by using the following command:

npm install rsuite
npm install next

Project Structure: It will look like this:

 

Step to Run Application: Run the application using the following command from the project’s root directory.

npm start

Example 1: We are importing the Dropdown Component from “rsuite”, and to apply the default styles of the components we are importing “rsuite/dist/rsuite.min.css”. We are adding the <Dropdown.Item> components within the Dropdown Component, the first <Dropdown.Item> one we have kept it simple to the other components we are passing the as prop as ‘a’ and passing values the href respectively.

App.js




import { Dropdown } from "rsuite";
import "rsuite/dist/rsuite.min.css";
  
function App() {
    return (
        <div className="App">
            <h4>
                React Suite Dropdown
                Used with next/link
            </h4>
            <Dropdown title="Tutorials">
                <Dropdown.Item>
                    Data Structures
                </Dropdown.Item>
  
                <Dropdown.Item as="a" href=
                "https://www.geeksforgeeks.org/">
                    Algorithms
                </Dropdown.Item>
  
                <Dropdown.Item as="a" href=
                "https://www.geeksforgeeks.org/">
                    GATE
                </Dropdown.Item>
            </Dropdown>
        </div>
    );
}
  
export default App;


Output:

 

Example 2: We are importing the Dropdown Component from “rsuite” and importing Link from ‘next/Link’, and to apply the default styles of the components, we are importing “rsuite/dist/rsuite.min.css”. We are creating a Component naming it newLink , this new component takes the href and children from the <Dropdown.Item> and wraps it within <Link> and <a> tags. Now to every <Dropdown.Item> component we are passing as a prop as newLink.

App.js




import { Dropdown } from "rsuite";
import "rsuite/dist/rsuite.min.css";
import Link from "next/link";
import React from "react";
  
const newLink = (props) => {
    const {
        href, children, ...rest
    } = props;
    return (
        <Link href={href} {...rest}>
            <a href={href} style={
                {
                    width: 500,
                    color: "green"
                }}>
                {" "}
                {children}
            </a>
        </Link>
    );
};
  
function App() {
    return (
        <div className="App">
            <h4>
                React Suite Dropdown
                Used with next/link
            </h4>
            <Dropdown title="Tutorials"
                style={{ marginLeft: 80 }}>
                <Dropdown.Item as={newLink} href=
                    "https://www.geeksforgeeks.org/">
                    Data Structures
                </Dropdown.Item>
  
                <Dropdown.Item
                    as={newLink} href=
                    Algorithms
                </Dropdown.Item>
  
                <Dropdown.Item
                    as={newLink} href=
                    GATE
                </Dropdown.Item>
            </Dropdown>
        </div>
    );
}
  
export default App;


Output:

 

Reference: https://rsuitejs.com/components/dropdown/#used-with-code-next-link-code

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32337 POSTS0 COMMENTS
Milvus
86 POSTS0 COMMENTS
Nango Kala
6706 POSTS0 COMMENTS
Nicole Veronica
11871 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11936 POSTS0 COMMENTS
Shaida Kate Naidoo
6823 POSTS0 COMMENTS
Ted Musemwa
7089 POSTS0 COMMENTS
Thapelo Manthata
6779 POSTS0 COMMENTS
Umr Jansen
6779 POSTS0 COMMENTS