How to Create ReactJS TypeScript Component with State without Props

When we use ReactJS, the first argument for component requires props. but if we don’t have props and only state, here is a way to define component.

Technically we are creating props object but it does not have any property.

import React from "react";

interface RegistrationPageState {
    firstName: string,
    lastName: string

export default class RegistrationPage extends React.Component<{}, RegistrationPageState> {
    constructor(props: {}) {
        this.state = {
            firstName: '',
            lastName: ''
    render(): React.ReactNode {
        return <p>Registration page details</p>;



Leave a Reply

Your email address will not be published. Required fields are marked *