Ich habe eine Web-App mit ReactJs und NextJs. In einer funktionalen Komponente habe ich verwendet Reagieren-Auswählen Dann erhalte ich die folgende Konsolenwarnung:
Warnung: Prop
id
hat nicht gepasst. Server: „react-select-7-input“ Client: „react-select-2-input“
Mein Code ist der folgende:
import { Row, Col, Card, Form, Button } from 'react-bootstrap';
import Select from 'react-select';
const priorityOptions = [
{ value: 'p1', label: 'Top level - P1' },
{ value: 'p2', label: 'Mid level - P2' },
{ value: 'p3', label: 'Low level - P3' }
];
const PostView = () => {
return (
<div className="DashboardSla-ContentBody__Form">
<Row>
<Col md="10">
<Card className="shadow-sm">
<Card.Body>
<Form>
<h5 className="text-secondary mb-3">Booking details</h5>
<Form.Group controlId="postType">
<Form.Label>Booking priority</Form.Label>
<Select
id="postType"
placeholder="Make a selection"
options={priorityOptions}
/>
</Form.Group>
<Button
type="submit"
variant="primary"
>Add Booking</Button>
</Form>
</Card.Body>
</Card>
</Col>
</Row>
</div>
)
}
export default PostView;
Haben Sie versucht, das einzustellen?
instanceId
? Siehe hier: reagieren-select.com/props Und github.com/JedWatson/react-select/issues/2629– David
18. April 2020 um 15:52 Uhr
Ich habe ersetzt
id="postType"
alsinstanceId="postType"
. In der Konsole wird immer noch ein Fehler angezeigt.– Sonjoy Datta
19. April 2020 um 5:11 Uhr
Haben Sie das jemals herausgefunden? Ich denke, es hat etwas mit der Rehydrierung einer SSR React-App zu tun, bin mir aber nicht sicher, wie ich das lösen kann.
– serraosays
3. Juli 2020 um 22:15 Uhr