In GetTariffs.js file, I get the tariff values from the GET-request. In the AddForm.js file there is a POST-request for sending data. There was a problem with the transfer of values from the GET-request (drop-down list) from GetTariffs.js file to AddForm.js file.
The values in the drop-down list are not displayed on the page:
But in the source code values are present:

GetTariffs.js:
import React, { Component } from 'react'
class GetTariffs extends Component {
constructor(props) {
super(props);
this.state = {
tariffs: [],
isLoaded: false,
}
}
componentDidMount() {
fetch('/api/v1/tariff/all')
.then(res => res.json())
.then(json => {
this.setState({
isLoaded: true,
tariffs: json,
})
})
}
render() {
var {isLoaded, tariffs} = this.state;
if (!isLoaded) {
return <div>loading</div>
}
else {
return (
<div>
{tariffs.map(tariff => {
return <option name="tariff" key={tariff.id} value={tariff.name}>
{tariff.name}
</option>
})}
</div>
)
}
}
}
export default GetTariffs
AddForm.js:
...
import GetTariffs from "./GetTariffs";
...
<form onSubmit={this.submitHandler}>
...
<div className="form-container">
<h5>Тариф</h5>
<div className="form-row">
<div className="form-group col-md-12">
<select id="inputState" className="form-control" onChange={this.changeGetTariffHandler}>
<GetTariffs/>
</select>
</div>
</div>
</div>
Fragmentinstead of adivfor wrapping your options so that it will get stripped out. adivis not a valid child ofselect.