Open In App

Domain name finder using ReactJS

Last Updated : 25 Jul, 2024
Summarize
Comments
Improve
Suggest changes
Like Article
Like
Share
Report
News Follow

In this article, we are going to make a domain name generator app that generates plenty of domain names related to our input keyword available to buy. In this domain name generator, we will take a text given by the user and will generate plenty of names related to the input text given, and by clicking on any of those we will be redirected to the domain buying website.

Let us have a look at how the final application will look like

Prerequisites: The pre-requisites for this project are.

Approach: 

We will divide the project into minor components and style each component individually. We will create functional components. The main component of our application will be class component which imports all the the other components and render accordingly. The suggestions will be fetched through a URL.

Steps to create the application:

Step 1: Start a project by the following command:

npx create-react-app foldername

Step 2: Now, go to the project folder i.e foldername:

cd foldername

Step 3: Now, go to the src folder and create a components folder. Under the components folder, create the following folders and their respective JSX files and CSS files:

  • App:
    • App.jsx
    • App.css
  • Header:
    • Header.jsx
    • Header.css
  • NameCard:
    • NameCard.jsx
    • NameCard.css
  • ResultContainer:
    • ResultContainer.jsx
    • ResultContainer.css
  • SearchBox:
    • SearchBox.jsx
    • SearchBox.css

Step 4: Create another folder image. Import the image you want to use.(optional)

Step 5: Now, open the console and install the following package:

npm install @rstacruz/startup-name-generator

Note: The above-mentioned package is open sourced at GitHub: https://github.com/rstacruz/startup-name-generator

Project Structure: It will look like the following.

The updated dependencies in package.json will look like:

"dependencies": {
"@rstacruz/startup-name-generator": "^0.3.0",
"@testing-library/jest-dom": "^5.17.0",
"@testing-library/react": "^13.4.0",
"@testing-library/user-event": "^13.5.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-scripts": "5.0.1",
"web-vitals": "^2.1.4"
}

Example: Write the code below in the mentioned file names in code block.

The below code contains the logic portion of each JSX file

JavaScript
// index.js

import React from 'react';
import ReactDOM from 'react-dom';
import App from './components/App/App';

ReactDOM.render(<React.StrictMode >
    <App />
</React.StrictMode>,
    document.getElementById('root')
);
JavaScript JavaScript JavaScript JavaScript JavaScript

The below files contain the styling of each document

CSS
/* App.css */

body {
   background: #0f1228;
   overflow-x: hidden;
   color: #e7e9f0;
   font-family: 'Lato', sans-serif;
}
CSS CSS CSS CSS

Steps to run the application: 

Step 1: Type the following command in terminal of your project directory

npm start

Step 2: Open http://localhost:3000/nameIt URL in the browser.

Output: 



Next Article

Similar Reads

three90RightbarBannerImg