|
localStorage.setItem('students', JSON.stringify(users.students)); |
Right now, allStudents is a functional component and it's render has a side effect behavior - it is calling localStorage.setItem. I would suggest turning this functional component into a class component, so that you can move the localStorage.setItem call into componentDidMount. This would be better because localStorage.setItem would only be called once, when the component is created, instead of being called every time the component is rendered (which can potentially be a lot of calls), which could make your render slow.
facg6-react/src/components/allStudents/index.jsx
Line 27 in 8260691
Right now, allStudents is a functional component and it's render has a side effect behavior - it is calling localStorage.setItem. I would suggest turning this functional component into a class component, so that you can move the localStorage.setItem call into componentDidMount. This would be better because localStorage.setItem would only be called once, when the component is created, instead of being called every time the component is rendered (which can potentially be a lot of calls), which could make your render slow.