Fork me on GitHub
#rum
<
2018-03-01
>
Roman Liutikov20:03:51

@amarjeet looks you are performing http req in :will-mount which is executed only once, when component is mounting into the DOM

Roman Liutikov20:03:21

also generally it’s not a good idea to perform IO within components or their lifecycle methods

amarjeet20:03:18

my use-case is that I want to fetch books for certain category from my db (server). this should happen, when a user selects a category on the web page - this should trigger an http call to fetch data, sending selected category as parameter

amarjeet20:03:44

Is there any other way to make it happen?

amarjeet20:03:45

and after user selects the category - the results should be shown right after

Roman Liutikov20:03:26

do it in :on-click handler for example

amarjeet20:03:53

hmm, that might be a good idea

amarjeet20:03:58

let me try this

amarjeet21:03:34

@roman01la yes, this is a better way. thanks 🙂