Provide data to component through prop or request

Posted 9 months ago by packy

I always find myself going back and forth on either passing my data through a prop and doing a request to an api. Is one specifically better, or faster? I know the reasoning behind an API in some cases is if I have to refresh the data but if the data is pretty much a static view should I pass it through a prop like:

<my-component :data="{{ $data }}"></my-component>

of just do a API GET request in the component?

Please sign in or create an account to participate in this conversation.

Laracasts Mascot

Hi, Have We Met Yet?

Did you know that, in addition to the forum, Laracasts includes well over 1000 lessons on modern web development? All for the price of one lunch out per month.

Sign Me Up


Reply to

Use Markdown with GitHub-flavored code blocks.