packy
255
7
Vue

Provide data to component through prop or request

Posted 1 year 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.

Reply to

Use Markdown with GitHub-flavored code blocks.