1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

@wireデコレータ

Last updated at Posted at 2024-11-05

英語ですが、以下の部分がメリットの1つだと思います。@wireを使わなくても直接APIをコールすれば同じようなことはできると思います。

参照だけならコーディングが少なくていいところがメリットではと思います

The Power of Wire Apex Class with Parameter

Wire apex class with parameter is a feature that enhances the capabilities of LWC by seamlessly integrating with Apex classes. It allows LWC components to retrieve specific data from Salesforce by invoking an Apex method with defined parameters. This dynamic data retrieval ensures that the user interface remains responsive and up-to-date.

By leveraging wire apex class with parameters, developers can create highly interactive and data-driven LWC components that provide a superior user experience. This feature eliminates the need for manual data handling and enables real-time updates based on user actions.

https://www.linkedin.com/pulse/wire-apex-class-parameter-salesforce-lwc-guide-swapnil-sable

Apexを呼び出す際にwireをつけなければならないという制約はないため、ご認識の通りwireをつけなくても実装は可能です。

リアクティブ変数のサポートであったりデータのプロビジョニングの観点では、wireを使う方がメリットが大きいです。

例えば、レコードの検索を行うApexに対して検索条件値を与える場合、検索条件値の変更によってApexを呼び出すことが簡単になります。

また、Apexを再度呼び出す処理についてもrefreshApexを使えば簡単になります。

ただし、これらもwireを使わずに実装することができますので、実装ができるかどうかの観点では使わなくても良いかと思います。(簡単かどうかは主観でしかないので、、、)

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?