I have changed my CRA react APP into TypeScript and I have a problem below.
I think sessionStorage.getItem('accesstoken') should be undefined or string or null
and I don't know how to type this object.
axios
.post(
`${process.env.REACT_APP_SERVER_URL}/pick`,
{
festivalId: newPick.festivalId,
},
{
headers: {
accesstoken: sessionStorage.getItem('accesstoken'),
},
}
)

accesstoken: sessionStorage.getItem('accesstoken') ?? '',or whatever value you want to give if there's nothing stored.?? ''in my code, it works!!