P粉5790084122023-07-28 12:34:25
You need to add a Props type or interface, and then you can obtain subjects through destructuring.
interface Props { subjects: any } export default function MainCategories({ subjects }: Props) { const tmp = props.subjects; ...
P粉1557104252023-07-28 00:35:26
I often use this pattern to achieve this, but the main key is defining the props.
import { FunctionComponent } from 'react'; interface Props { // In your case subjects: any } const MainCategories: FunctionComponent<Props> = ({subjects}) => ( ... ); export default MainCategories;