Я создаю модуль входа в систему с помощью mongodb, выражаю и реагирую, но при создании этого я столкнулся с историей свойств, не существует ошибки:
Свойство 'history' не существуетсуществуют по типу «Только для чтения и только для чтения <{children ?: ReactNode;}> '. ts (2339)
import React, { Component } from 'react'
import { login } from './userfunctions'
interface userprops{}
interface data{
email:string;
password:string;
errors: string;
}
// основной класс:
class Login extends Component<userprops, data> {
constructor(props: userprops) {
super(props)
this.state = {
email: '',
password:'',
errors: ''
}
this.onChange = this.onChange.bind(this) //binding the function
this.onSubmit = this.onSubmit.bind(this) //binding the function
}
onChange(e:any) { //on change function
this.setState({ email: e.target.value })
}
onSubmit(e:any) { //on submitting the form in render function this function will fire
e.preventDefault()
const user = {
email: this.state.email,
password: this.state.password
}
login(user).then(res => { //I had created login function in another component
if (res) {
this.props.history.push(`/profile`) //this line is giving error
}
})
}
render() {
//rendering data
}
export default Login
сообщение об ошибке:
Свойство 'history' не существует для типа 'Readonly & Readonly <{children ?: ReactNode;}> '. ts (2339)
Я много чего перепробовал, но эта ошибка не исчезнет
это должно запуститься