const [ surname, setSurname] = useState<string>('');
interface IData {
surname: string;
}
let dataArray: IData[] = [];
const dataTest: IData = {
surname: surname,
};
const setDataLocal = () => {
const dataLocal = JSON.parse( localStorage.getItem('data'));
// dataLocal.push(dataTest)
// console.log(dataLocal);
dataLocal.push(dataTest)
};
const dataLocal = JSON.parse(localStorage.getItem('data') || '[]');
const value = localStorage.getItem('data');
if (value) {
const dataLocal = JSON.parse(value);
}
const value = localStorage.getItem('data');
if (!value) {
return;
}
const dataLocal = JSON.parse(value);