Property timeago doesn't exist on FoodPost: export type Props = { addMessage: (string)…
- User
Property timeago doesn't exist on FoodPost:
export type Props = { addMessage: (string) => void, data: FoodData; theme: MD3Theme; };
class FoodPost extends React.Component { constructor(props: Props) { super(props); this.state = { expanded: false, }; this.timeAgo = getTimeAgo(props.data.date); }
- Assistant
It looks like you're trying to assign
this.timeAgoin the constructor based on theprops.data.date, buttimeAgois not defined as a property in yourPropsorStatetypes, and it is not being initialized properly within the component.To fix this, you should either: