Closed Joelzor closed 1 year ago
If you are using the same currentUser and the same fetch, ie it is the same data it would be wiser to pass this data down to this component - only if this is possible with your current structure. Ideally you want to just work from the one user state, and not fetch multiple times unnecessarily.
We considered that but in that way, if the user was to directly access for example, profiles/2/edit in the URL bar, we wouldn't have the data no? I can't imagine many people would do that, but still ;)
Not sure on your current structure, but if ProfileEdit is within ProfilePage you would just pass the prop down to the component, so would have access to the data
Is it possible to add these issues to the todo list? Could we maybe add fetch in both then try to refactor later if possible?
Sure thing, just remember if you are trying to fetch exactly the same thing then you should try to find a way of only doing it once, then passing the data wherever you need :)
We'll try to make that work, thank you :) :)
dependent on #130
Set up state values
[currentUser, setCurrentUser]
as a state valueForm control
value={currentUser.firstName}