You can use spread operator to reduce code.

class TextInput extends React.Component {
  constructor(props) {
    super(props);
  }
  render() {
    return <input {...this.props} />;
  }
}

export default TextInput;

This way you even don't need a seperate PasswordInput component.

<TextInput id="name" type="text" placeholder="Your Name" />
<TextInput id="password" type="password" />
Answer from SuleymanSah on Stack Overflow
🌐
Medium
medium.com › @rashmipatil24 › reusable-react-components-7b025f232ca4
A Guide to Building Reusable React Components
September 21, 2024 - When creating reusable components, it’s important to ensure that they can be styled consistently across your application. You can achieve this by using CSS classes, styled-components, or CSS-in-JS libraries like Emotion or Styled Components.
🌐
freeCodeCamp
freecodecamp.org › news › how-to-build-reusable-react-components
How to Build Reusable React Components
February 28, 2024 - What are reusable React components? You can think of them as building blocks. They are independent pieces of code that can be reused throughout your website to save you time and effort. They can be anything from simple buttons to complex forms. Why U...
Discussions

What is the proper way to create reusable components react
Learning react and building a page where there is lots of input fields. I want to create components for different input types so later i can use them instead of creating inputs over and over again.... More on stackoverflow.com
🌐 stackoverflow.com
Is it always a good practice to do reusable components ?
It’s recommended but it depends the context and the responsibility of the components. Sometimes when you look for reusability you ends up creating excessive abstraction on your software components. More on reddit.com
🌐 r/reactjs
67
47
January 27, 2024
Is it not possible to create reusable components like React in templating languages
You absolutely can. I do with Django templating language. You simply use extend and include template tags. More on reddit.com
🌐 r/htmx
33
8
February 20, 2024
Best practices for reusable forms
Like you said, You should definitely have a form state management abstraction of some kind, you really don’t want to be creating your own form state logic from scratch for every form. It’s not just better at scale, it’s better in every case. Building your own would be a fun exercise though, definitely a great learning experience. The beginning of building something like this is actually a custom hook that will manage the form state (errors and inputs). Then whatever is returned from that hook could get passed to your form input components where they could handle updating the text values etc Some people argue uncontrolled should be preferred until controlled is required. I think that just adds complexity for no good reason and always use controlled because it’s simpler to implement a non-terrible UX (input specific, validation step specific error messages) react-hook-form plus the zod resolver works really well once you decide to learn a library. More on reddit.com
🌐 r/reactjs
15
5
July 26, 2023
🌐
Brockherion
brockherion.com › blog › building-reusable-components-in-react-with-typescript-and-generics
Building Reusable Components in React with Typescript and Generics — Brock Herion
In this article, I will be showing you how you can use Typescript generics to build reusable and more robust components for your React applications
🌐
LogRocket
blog.logrocket.com › home › building reusable ui components with react hooks
Building reusable UI components with React Hooks - LogRocket Blog
June 4, 2024 - A search bar component can be used ... Creating a reusable search bar component in React is straightforward. In your components folder, create a SearchBar.jsx file and add the following code to it:...
🌐
UXPin
uxpin.com › home › how to build reusable react components
How to Build Reusable React Components | UXPin
October 16, 2025 - These principles provide a solid foundation for crafting React components that are both powerful and reusable. Creating reusable React components involves following thoughtful design practices and leveraging established patterns.
🌐
GeeksforGeeks
geeksforgeeks.org › reactjs › how-to-make-reusable-react-components
How to make Reusable React Components ? - GeeksforGeeks
August 13, 2025 - Step 2: After creating your project folder(i.e. gfg), move to it by using the following command: ... Example: This below example demonstrate the Reusable React Components. In this example, You can see ProductList and ProductItem component can be composed together and accept props for customization and are reusable with different data sets. ... //File path: src/App.js import React from 'react'; import ProductList from './ProductList.js'; const App = () => { const products = [ { id: 1, name: 'Product 1', price: 10 }, { id: 2, name: 'Product 2', price: 20 }, { id: 3, name: 'Product 3', price: 30 }, ]; return ( <div style={{ margin: '5px' }}> <h2 style={{ color: 'green' }}> GeeksForGeeks | Reusable Components Example </h2> <ProductList products={products} /> </div> ); }; export default App;
Find elsewhere
🌐
ButterCMS
buttercms.com › blog › building-reusable-components-using-react
How to Build Reusable Components Using React
July 16, 2025 - For a React component to be truly reusable, it should avoid side effects like data fetching, reading from localStorage, or making API calls. These actions can lead to unpredictable behavior, since the results may vary depending on when or where you use the component.
🌐
Theodorus Clarence
theodorusclarence.com › blog › fully-reusable-components
How to Create Fully Reusable React Components | theodorusclarence.com
April 21, 2024 - While it is a good practice to spread all of the props, do note that not all component needs to be fully reusable. For example, a ProductList component that renders a list of products, probably only needs to be customizable in the className props. You can use Pick for that, and take only the className props. interface ProductListProps extends Pick<React.ComponentPropsWithoutRef<'div'>, 'className'> { product: Product; } // No need to spread since we only need className export default function ProductList({ className, products }: ProductListProps) { return ( <div className={cn(['grid-cols-3', className])}> {products.map((product, i) => ( <Card key={product.id} product={product} /> ))} </div> ); }
🌐
egghead.io
egghead.io › lessons › react-create-a-simple-reusable-react-component
Create a Simple Reusable React Component | egghead.io
[04:49] To review, to create a component that is reusable throughout your application and as composable as any other of the JSX that you have available to you is you create a function that has a capital letter as the first character.
Published   September 26, 2017
🌐
freeCodeCamp
freecodecamp.org › news › how-to-create-a-truly-reusable-react-component-from-scratch
How to Create a Truly Reusable React Component from Scratch
August 20, 2021 - As we have seen in this tutorial, by creating a reusable InputControl component and using ref to manage each input textbox's suggestion separately, we're able to create a truly reusable component for showing autocomplete suggestions. You can find the complete source code for this tutorial in this repository and live demo here. If you want to learn Redux in detail from scratch and build 3 apps along with the complete food ordering app, check out the Mastering Redux course. ... How to use Redux in React using the react-redux library to make your app reactive.
🌐
SitePoint
sitepoint.com › blog › javascript › a practical guide to creating reusable react components
A Practical Guide to Creating Reusable React Components — SitePoint
February 19, 2024 - Therefore, building a flexible, reusable layout that can be utilized in many different pages is essential. This will save you very many lines of code and consequently a tremendous amount of time. Consider the following React functional component: // Feed.js import React from "react"; import style from "./Feed.module.css"; export default function Feed() { return ( <div className={style.FeedContainer}> <header className={style.FeedHeader}>Header</header> <main className={style.FeedMain}> { <div className={style.ItemList}> {itemData.map((item, idx) => ( <div key={idx} className={style.Item}> {item} </div> ))} </div> } </main> <footer className={style.FeedFooter}>Footer</footer> </div> ); } const itemData = [1, 2, 3, 4, 5];
🌐
Robin Wieruch
robinwieruch.de › react-reusable-components
Reusable Components in React
May 26, 2019 - A tutorial about reusable components in React by example. By extracting a component from another one in React, you may create a reusable component ...
🌐
Medium
medium.com › cstech › building-reusable-ui-components-with-react-best-practices-and-patterns-24b6fe921347
Building Reusable UI Components with React: Best Practices and Patterns | by Umur Akbulut | ÇSTech | Medium
May 18, 2023 - By identifying reusable components, creating a design system, using props for customization, keeping components small and focused, and using advanced React patterns, you can create UI components that can be used throughout your application.
🌐
Angular Minds
angularminds.com › blog › how-to-create-and-use-reusable-react-components
How to Create and Use Reusable React Components
March 21, 2024 - The React Context API enables developers to handle states at a higher level, providing a simple and effective solution for sharing global data between components. By creating reusable contexts, developers can streamline state management and address common challenges like theming or authentication with ease. ... // ThemeContext.js import { createContext, useState, useContext } from 'react'; const ThemeContext = createContext(); export const ThemeProvider = ({ children }) => { const [theme, setTheme] = useState('light'); const toggleTheme = () => { setTheme((prevTheme) => (prevTheme === 'light' ?
🌐
DEV Community
dev.to › gkhan205 › learn-how-to-create-reusable-components-in-reactjs-49h9
Learn how to create reusable components in reactjs. - DEV Community
December 23, 2019 - All you did was put a React wrapper around the HTML button element and called a reusable component.
🌐
OpenReplay
blog.openreplay.com › writing-clean-reusable-components-in-react
Writing clean, reusable components in React
This section covers the best practices to follow when building reusable components so they don’t become a thorn in your flesh in the future. Props in React are used to pass data from one component to another.
🌐
Pluralsight
pluralsight.com › courses › react-creating-reusable-components
Creating Reusable React Components
In this course, Creating Reusable React Components, you'll explore over 50 decisions to consider when designing, creating, and publishing reusable React components, including atomic design, documentation generation, styling, theming, testing, packaging, and publishing.
🌐
Bit
bit.dev › blog › how-to-reuse-react-components-across-your-projects-l4pz83f4
How to reuse React components across your projects
By using Bit, we can easily create reusable components. From versioning, building, testing, and even managing component dependencies, Bit takes care of everything for us. Let's first make sure Bit is installed.
🌐
Reddit
reddit.com › r/reactjs › is it always a good practice to do reusable components ?
r/reactjs on Reddit: Is it always a good practice to do reusable components ?
January 27, 2024 -

Hello all, i'm a junior dev working on a React app and i'm in the process of coding a simple data table with pagination and such .. Usually i'm trying to set up reusable components for buttons and inputs as it is simple to do but for the data table it's taking the complexity of the component to a new level if i try to make it reusable.

So the question is : Is it always a good idea to make components reusable even if they're used like 6 times at most in the whole app and it makes the code more complex ?