I am trying to make a component which receiving a function as a props. i want to pass some value into function while calling it:
class Course extends Component {
    render() {
        return (
             <div>
                 <div id="courses">
                      <p onClick={this.props.sumPrice}>{this.props.name}<b>{this.props.price}</b></p>
                 </div>
             </div>
        );
     }
 }
sumPrice is a function define in parent component and its need a value.
This is my sumPrice function and parent class constructor code:
constructor(props) {
    super(props);
    this.state = {
        active: false,
        total: 0
    };
    this.sumPrice = this.sumPrice.bind(this);
}
sumPrice(price) {
    this.setState({ total: this.state.total + price });
}
 
    