---
title: "Discussion on \"Typescript: Create a React Component with conditional props for each variant\" | Hashnode"
description: "Discussion on \"Typescript: Create a React Component with conditional props for each variant\". Instead of  making a prop optional, we can specify different variants for a component and ensure type safety"
url: "https://hashnode.com/posts/typescript-create-a-react-component-with-conditional-props-for-each-variant/64d0d360d79acf0457890680"
---

[Feed](https://hashnode.com/feed) /

Discussion

# [Typescript: Create a React Component with conditional props for each variant](https://lwilsondev.co.uk/typescript-create-a-react-component-with-conditional-props-for-each-variant?utm_source=hashnode&utm_medium=feed)

Instead of making a prop optional, we can specify different variants for a component and ensure type safety

Aug 7, 2023 · 2 min read · lwilsondev.co.uk  
Read the article

-   [#typescript](https://hashnode.com/tag/typescript)
-   [#reactjs](https://hashnode.com/tag/reactjs)

## Written by

[Lucy Wilson](https://hashnode.com/@LWilsonDev)

@LWilsonDev · Glasgow, United Kingdom

  
[View profile](https://hashnode.com/@LWilsonDev)

Software developer

I am a senior software developer at Estendio, mainly working in React Native with Typescript, as well as a sprinkling of web dev using React and PHP.

## Responses

Markdown supported · ⌘↵ to post

No responses yet.
