Dostaje bład
Uncaught TypeError: Cannot read properties of null (reading 'value')
tutaj jest cały kod
import React, { useState, useRef } from "react";
// import props from "./Props";
export default function Addcard() {
const [count, setCount] = useState(0);
const parentReference = useRef(null);
function AddCard() {
// props.push(
{
Img: parentReference.current.querySelector("#input-1").value,
Rating: parentReference.current.querySelector("#input-2").value,
ReviewPost: parentReference.current.querySelector("#input-3").value,
Country: parentReference.current.querySelector("#input-4").value,
Title: parentReference.current.querySelector("#input-5").value,
Cost: parentReference.current.querySelector("#input-6").value,
}
//);
setCount((count) => (count = 0));
}
function plus() {
setCount((count) => (count = 1));
}
return (
<div className="Card-container Card-container-add">
{count === 0 ? (
<div className="Card-arrows">
<span className="arrow-n-e">↖ </span>
<span className="arrow-n-w"> ↗ </span>
<button className="addcard-button" onClick={plus}>
+
</button>
<span className="arrow-s-e">↘ </span>
<span className="arrow-s-w"> ↙</span>
</div>
) : (
<div className="Card-inputs">
<input className="addcard-inputs" id="input-1" ref={parentReference} placeholder="Image url"></input>
<input className="addcard-inputs" id="input-2" ref={parentReference} placeholder="Rating"></input>
<input className="addcard-inputs" id="input-3" ref={parentReference} placeholder="ReviewPost"></input>
<input className="addcard-inputs" id="input-4" ref={parentReference} placeholder="Country"></input>
<input className="addcard-inputs" id="input-5" ref={parentReference} placeholder="Title"></input>
<input className="addcard-inputs" id="input-6" ref={parentReference} placeholder="Cost"></input>
<input type="button" value="Save" onClick={AddCard} className="addcard-inputs-button"></input>
</div>
)}
</div>
);
}