I am using MERN stack and Redux. I have a jwtToken saved to local storage when a user logs in. I have a form for submitting information and one of the properties on that form is author which i want to automatically populate with the id of the user who is logged in. To access this form you need to be logged so the information will always be there. Anyone have any idea how i do this? This is what i have just now but it doesn't work. As well as being saved in local storage it is accessible via the global state but again i don't really know how to access this or which option is better to use.
class AddSubject extends Component {
constructor() {
super();
const user = localStorage.getItem("jwtToken");
this.state = {
title: "",
summary: "",
description: "",
author: user._id,
errors: {},
};
}