どうも。えーたん(@eetann092)です。 @extend-chrome/storageが便利なので紹介します。 @extend-chrome/storageとは? @extend-chrome/storageは、Chrome拡張機能のAPIchrome.storageのラッパーです。 メリットは以下の3つです。 storageから取得した値の処理をコールバックではなくasync/awaitを使って書くことができる 型情報を追加できる ストレージをBucketとして区切ることができる 実際の例を交えて説明します。 まずはchrome.storageをラッパー無しで使った例です。saveCountでchrome.storage.local.setを、loadCountでchrome.storage.local.getを使っています。 import { useState } from "r
![Chrome拡張機能のストレージを扱う時に@extend-chrome/storageが便利](https://cdn-ak-scissors.b.st-hatena.com/image/square/6ece695b7a3e4da0211d8ef196571739e7cf915e/height=288;version=1;width=512/https%3A%2F%2Fres.cloudinary.com%2Fzenn%2Fimage%2Fupload%2Fs--Wm-jQDV1--%2Fc_fit%252Cg_north_west%252Cl_text%3Anotosansjp-medium.otf_55%3AChrome%2525E6%25258B%2525A1%2525E5%2525BC%2525B5%2525E6%2525A9%25259F%2525E8%252583%2525BD%2525E3%252581%2525AE%2525E3%252582%2525B9%2525E3%252583%252588%2525E3%252583%2525AC%2525E3%252583%2525BC%2525E3%252582%2525B8%2525E3%252582%252592%2525E6%252589%2525B1%2525E3%252581%252586%2525E6%252599%252582%2525E3%252581%2525AB%252540extend-chrome%25252Fstorage%2525E3%252581%25258C%2525E4%2525BE%2525BF%2525E5%252588%2525A9%252Cw_1010%252Cx_90%252Cy_100%2Fg_south_west%252Cl_text%3Anotosansjp-medium.otf_37%3Aeetann%252520%25252F%252520%2525E3%252581%252588%2525E3%252583%2525BC%2525E3%252581%25259F%2525E3%252582%252593%252Cx_203%252Cy_121%2Fg_south_west%252Ch_90%252Cl_fetch%3AaHR0cHM6Ly9zdG9yYWdlLmdvb2dsZWFwaXMuY29tL3plbm4tdXNlci11cGxvYWQvYXZhdGFyL2NlNzJlMDliNzkuanBlZw%3D%3D%252Cr_max%252Cw_90%252Cx_87%252Cy_95%2Fv1627283836%2Fdefault%2Fog-base-w1200-v2.png)