Никак не могу из одного файла поменять статус в другом, пытался отправлять <Smallblock terms='1212' />
, но в console.log(this.props)
не приходит
Вот код:
send:
import React, {Component} from 'react';
import Smallblock from './Smallblock';
import '../css/sendpost.css';
class Sendpost extends Component {
constructor(props) {
super(props);
this.state = {
text: ""
}
this.handleTextChange = this.handleTextChange.bind(this);
this.handleSubmit = this.handleSubmit.bind(this);
}
handleSubmit(event) {
event.preventDefault();
this.setState({text: ""});
<Smallblock terms='1212' />
}
handleTextChange(event) {
this.setState({text: event.target.value});
}
render() {
return (
<div className="form_input">
<form onSubmit={this.handleSubmit}>
<input type='text' className="inputtext" placeholder="Что у вас нового?" value={this.state.text} onChange={this.handleTextChange} />
<button>Send</button>
</form>
</div>
);
}
}
export default Sendpost;
Smallblock:
import React, {Component} from 'react';
import '../css/smallblock.css';
class Smallblock extends Component {
constructor(props) {
super(props);
console.log(this.props);
alert(this.props);
this.state = {
count: "1"
}
}
render() {
return (
<div className="smallblock">
<div className="count">{this.state.count}</div>
<div className="text">Записей</div>
</div>
);
}
}
export default Smallblock;