I have the next component in ReactJs:
function App() {
function handleClick(e) {
console.log('click ', e);
localStorage.setItem('my-item', e.key);
console.log(localStorage.getItem('my-item'))
}
return (
<div>
<Menu
selectedKeys={e.key}
style={{ width: 500px}}
onClick={handleClick}
>
...another code
}
There i used AntDesign. The function handleClick write in my localstorage the key of an item. It works, but i want to pass in selectedKeys the key that i passed in the localstorage, so i want to do this selectedKeys={e.key}, but i can't do this. How to pass the data e.key from the function to<Menu> tag?