guanacone / fullstack_app

BSD Zero Clause License
0 stars 0 forks source link

edit user #18

Closed guanacone closed 4 years ago

guanacone commented 4 years ago

Yesterday you mentioned that the actual Implementation of edit-user only works if I navigate from the user-profile to the edit page and that I should grab the ID from the url. How exactly would I achieve that? props.location provides the pathname which is a string and search that would be a query string. Thanks for the hint

edwmurph commented 4 years ago

i haven't done this exact thing before but this is a pretty good summary of the options you have:

https://css-tricks.com/how-to-the-get-current-page-url-in-gatsby/

i'd probably recommend something like method 2 from that article and then use a regular expression to extract the id from the url

guanacone commented 4 years ago

Pretty much what I came up. Does my app really need that feature? What are the use cases of an user not following a link to access the edit page?

edwmurph commented 4 years ago

I think it's not too much more work and will also help when you want to have other pages link to the user page. This way anywhere can link to it and it centralizes the code that dynamically fetches the user details when the page loads

Happy to keep discussing this further if you or an article you find on it has other thoughts