Working with an array in local. storage, React.js

Faced with this situation, I am writing an application on the React functional component.js, there is a state that is read from local. storage, and if it is empty, it is replaced with the default value, in my case it is an empty array. I need to click on the button from the text input that is in my application to take the value and set it in this state, adding the first and then the next elements of the array.

I tried to do this

const useLocalStorageList = (key, defaultValue) => {
        const stored = localStorage.getItem(key);
        const initial = stored ? JSON.parse(stored) : defaultValue;
        const [value, setValue] = useState(initial);

        useEffect(() => {
            localStorage.setItem(key, JSON.stringify(value));
        }, [key, value]);

        return [value, setValue];
    };
const [state, setState] = useLocalStorageList('Load Range', [])

const myInput = document.getElementById('textInputId')
setState(state.push(myInput.value));

But in the panel for example, in the Application tab, I see that the object Load Range, the value of an empty array is replaced by the number 1, and the second click on the button, React gives the error

TypeError: state.push is not a function

Author: Miltosh, 2020-10-22