Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #547
    jacob_smith
    Participant

    I’m a little bit confused because you can put initialize data on the mount and render method of livewire. When you pull data from the database and set it in the mount method you always have to associate it with some public properties. When you pull data from the database and set it in the render method, you don’t associate it with a public properties.

    Things I observe:

    (1) Refresh method will refresh data when its set in the render method. This is not true with the mount method.
    (2) Since render method is not associated with public properties, use mount method to initialize data .

    #548
    dan
    Participant

    I think when the sole of component is just to re render itself , its better to declare data on the render method.

    However if you have a data that you want to be reactive not just for rendering purposes , like you wanted to increment a certain number etc then use the mount method to set the data and create methods that will make the data reactive.

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.