This is my Code
App.tsx
import React, { useState } from 'react';
import logo from './logo.svg';
import './App.css';
import { TextField } from './components/TextField';
function App() {
return (
<div className="App">
<TextField name='fef' age=12/>
</div>
);
}
export default App;
TextField.tsx
import React,{useEffect, useRef, useState} from "react";
interface Props{
name: string;
age: number;
}
export const TextField:React.FC<Props> = ({name,age}) => {
return (
<div>
<h2>Hello {name}, and I know that you are {age} years old</h2>
</div>
);
}
But I am getting this Error!
Type 'boolean' is not assignable to type 'number'.ts(2322)
TextField.tsx(5, 5): The expected type comes from property 'age' which is declared here on type 'IntrinsicAttributes & Props & { children?: ReactNode; }'
What should I have to do?
Please give me a Solution for this. I am New to React and Typescript.
