{"id":11077,"date":"2026-02-19T19:44:06","date_gmt":"2026-02-19T10:44:06","guid":{"rendered":"https:\/\/code-plus.jp\/gp\/?p=11077"},"modified":"2026-02-19T19:44:06","modified_gmt":"2026-02-19T10:44:06","slug":"tauri-2x-11077","status":"publish","type":"post","link":"https:\/\/code-plus.jp\/gp\/tauri-2x-11077\/","title":{"rendered":"Tauri 2.x \u3067\u30c7\u30b9\u30af\u30c8\u30c3\u30d7\u30a2\u30d7\u30ea\u3092\u4f5c\u308b\u6642\u306b\u30cf\u30de\u3063\u305f\u30dd\u30a4\u30f3\u30c8\u3068\u89e3\u6c7a\u7b56"},"content":{"rendered":"<p>Tauri 2.x + React + TypeScript \u3067\u30c7\u30b9\u30af\u30c8\u30c3\u30d7\u30a2\u30d7\u30ea\u3092\u958b\u767a\u3057\u305f\u969b\u306b\u906d\u9047\u3057\u305f\u554f\u984c\u3068\u89e3\u6c7a\u7b56\u3092\u307e\u3068\u3081\u307e\u3057\u305f\u3002\u3053\u308c\u304b\u3089 Tauri \u3067\u30a2\u30d7\u30ea\u3092\u4f5c\u308b\u65b9\u306e\u53c2\u8003\u306b\u306a\u308c\u3070\u5e78\u3044\u3067\u3059\u3002\u5b9f\u969b\u306e\u958b\u767a\u3067\u906d\u9047\u3057\u305f\u4ee5\u4e0b\u306e\u554f\u984c\u3092\u89e3\u8aac\u3057\u307e\u3059\u3002<\/p>\n\n<!-- \u2605\u76ee\u6b21\u30ea\u30b9\u30c8 -->\n<ul class=\"tocList mt-1r\" data-toc-id=\"js-tocBWGD\" style=\"height:28rem\"><\/ul>\n<ins class=\"tocBtn is-fixed\" data-toc-id=\"js-tocBWGD\"><\/ins>\n\n\n\n\n\n\n\n<hr class=\"separator mt-3r\">\n\n<h2 class=\"fz-xl\">1. .app \u304c\u8d77\u52d5\u3057\u306a\u3044 \u2014 \u30d7\u30e9\u30b0\u30a4\u30f3\u8a2d\u5b9a\u306e\u7f60<\/h2>\n<p class=\"mt-1r\"><b class=\"fw-600\">\u75c7\u72b6<\/b><\/p>\n<p><code>npm run tauri build<\/code> \u3067\u30d3\u30eb\u30c9\u3057\u305f <code>.app<\/code> \u3092\u30c0\u30d6\u30eb\u30af\u30ea\u30c3\u30af\u3057\u3066\u3082\u4f55\u3082\u8d77\u304d\u306a\u3044\u3002\u958b\u767a\u7248\uff08<code>tauri dev<\/code>\uff09\u3067\u306f\u52d5\u304f\u306e\u306b\u3001\u30ea\u30ea\u30fc\u30b9\u30d3\u30eb\u30c9\u3060\u3051\u30af\u30e9\u30c3\u30b7\u30e5\u3059\u308b\u3002<\/p>\n<p class=\"mt-1r\"><b class=\"fw-600\">\u539f\u56e0<\/b><\/p>\n<p>\u30d0\u30a4\u30ca\u30ea\u3092\u76f4\u63a5\u5b9f\u884c\u3059\u308b\u3068\u3001\u4ee5\u4e0b\u306e\u30a8\u30e9\u30fc\u304c\u51fa\u307e\u3057\u305f\u3002<\/p>\n<pre><code class=\"language-\">thread &#39;main&#39; panicked at src\/lib.rs:23:10:\nTauri \u30a2\u30d7\u30ea\u306e\u8d77\u52d5\u306b\u5931\u6557\u3057\u307e\u3057\u305f: PluginInitialization(&quot;dialog&quot;,\n&quot;Error deserializing &#39;plugins.dialog&#39; within your Tauri configuration:\ninvalid type: map, expected unit&quot;)\n<\/code><\/pre>\n<p>\u539f\u56e0\u306f <code>tauri.conf.json<\/code> \u306e\u66f8\u304d\u65b9\u3067\u3057\u305f\u3002<\/p>\n<pre><code class=\"language-json\">\/\/ \u274c \u3053\u308c\u304c\u30c0\u30e1\n&quot;plugins&quot;: {\n    &quot;dialog&quot;: {},\n    &quot;store&quot;: {},\n    &quot;autostart&quot;: {}\n}\n<\/code><\/pre>\n<p><code>tauri-plugin-dialog<\/code> \u306f\u8a2d\u5b9a\u3092\u6301\u305f\u306a\u3044\u30d7\u30e9\u30b0\u30a4\u30f3\uff08Config \u578b\u304c <code>unit<\/code>\uff09\u3067\u3059\u3002\u7a7a\u30aa\u30d6\u30b8\u30a7\u30af\u30c8 <code>{}<\/code> \u306f JSON \u3067\u306f <code>map<\/code> \u578b\u306a\u306e\u3067\u3001serde \u304c\u30c7\u30b7\u30ea\u30a2\u30e9\u30a4\u30ba\u3067\u304d\u305a\u306b panic \u3057\u307e\u3059\u3002<\/p>\n<p class=\"mt-1r\"><b class=\"fw-600\">\u89e3\u6c7a\u7b56<\/b><\/p>\n<p>\u8a2d\u5b9a\u3092\u6301\u305f\u306a\u3044\u30d7\u30e9\u30b0\u30a4\u30f3\u306f <code>tauri.conf.json<\/code> \u306b\u66f8\u304b\u306a\u3044\u3002<\/p>\n<pre><code class=\"language-json\">\/\/ \u2705 plugins \u30bb\u30af\u30b7\u30e7\u30f3\u81ea\u4f53\u3092\u524a\u9664\n\/\/ \u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u521d\u671f\u5316\u306f Rust \u5074\u3067\u884c\u3046\n<\/code><\/pre>\n<pre><code class=\"language-rust\">\/\/ src-tauri\/src\/lib.rs\ntauri::Builder::default()\n    .plugin(tauri_plugin_dialog::init())\n    .plugin(tauri_plugin_store::Builder::default().build())\n    .plugin(tauri_plugin_autostart::init(\n        MacosLauncher::LaunchAgent,\n        None,\n    ))\n<\/code><\/pre>\n<p class=\"mt-1r\"><b class=\"fw-600\">\u6559\u8a13<\/b><\/p>\n<ul style=\"list-style-type:bullet;\" class=\"mb-0.5r\">\n  <li><code>.app<\/code> \u304c\u8d77\u52d5\u3057\u306a\u3044\u6642\u306f\u3001\u30d0\u30a4\u30ca\u30ea\u3092\u76f4\u63a5\u5b9f\u884c\u3057\u3066\u30a8\u30e9\u30fc\u3092\u78ba\u8a8d\u3059\u308b<\/li>\n  <li>\u30d7\u30e9\u30b0\u30a4\u30f3\u306e Config \u578b\u3092\u78ba\u8a8d\u3057\u3066\u304b\u3089 <code>tauri.conf.json<\/code> \u306b\u66f8\u304f<\/li>\n  <li>\u8a2d\u5b9a\u4e0d\u8981\u306a\u30d7\u30e9\u30b0\u30a4\u30f3\u306f conf.json \u306b\u8a18\u8f09\u3057\u306a\u3044<\/li>\n<\/ul>\n<h2 class=\"fz-xl\">2. async \u30b3\u30de\u30f3\u30c9\u3067\u30d6\u30ed\u30c3\u30ad\u30f3\u30b0I\/O<\/h2>\n<p class=\"mt-1r\"><b class=\"fw-600\">\u75c7\u72b6<\/b><\/p>\n<p>Tauri \u30b3\u30de\u30f3\u30c9\u3092 <code>pub async fn<\/code> \u3067\u5ba3\u8a00\u3057\u3066\u3044\u308b\u306e\u306b\u3001\u30d5\u30a1\u30a4\u30eb\u64cd\u4f5c\u4e2d\u306b UI \u304c\u30d5\u30ea\u30fc\u30ba\u3059\u308b\u3002<\/p>\n<p class=\"mt-1r\"><b class=\"fw-600\">\u539f\u56e0<\/b><\/p>\n<p>async \u95a2\u6570\u5185\u3067 <code>std::fs<\/code> \u306e\u540c\u671f\u95a2\u6570\u3092\u4f7f\u3063\u3066\u3044\u307e\u3057\u305f\u3002<\/p>\n<pre><code class=\"language-rust\">\/\/ \u274c async fn \u5185\u3067\u540c\u671fI\/O\n#&lsqb;tauri::command&rsqb;\npub async fn read_file(path: String) -&gt; Result&lt;String, String&gt; {\n    std::fs::read_to_string(&amp;path)  \/\/ \u2190 tokio \u30e9\u30f3\u30bf\u30a4\u30e0\u3092\u30d6\u30ed\u30c3\u30af\n        .map_err(|e| format!(&quot;\u30a8\u30e9\u30fc: {}&quot;, e))\n}\n<\/code><\/pre>\n<p class=\"mt-1r\"><b class=\"fw-600\">\u89e3\u6c7a\u7b56<\/b><\/p>\n<p><code>tokio::fs<\/code> \u3092\u4f7f\u3063\u3066\u975e\u540c\u671fI\/O\u306b\u3059\u308b\u3002<\/p>\n<pre><code class=\"language-rust\">\/\/ \u2705 tokio::fs \u3067\u975e\u540c\u671fI\/O\n#&lsqb;tauri::command&rsqb;\npub async fn read_file(path: String) -&gt; Result&lt;String, String&gt; {\n    tokio::fs::read_to_string(&amp;path)\n        .await\n        .map_err(|e| format!(&quot;\u30a8\u30e9\u30fc: {}&quot;, e))\n}\n<\/code><\/pre>\n<p><code>Cargo.toml<\/code> \u306b tokio \u306e fs feature \u3092\u8ffd\u52a0\u3002<\/p>\n<pre><code class=\"language-toml\">&lsqb;dependencies&rsqb;\ntokio = { version = &quot;1&quot;, features = &lsqb;&quot;fs&quot;&rsqb; }\n<\/code><\/pre>\n<p class=\"mt-1r\"><b class=\"fw-600\">\u6ce8\u610f\u70b9<\/b><\/p>\n<p><code>file_exists<\/code> \u3082\u540c\u69d8\u3067\u3059\u3002<code>Path::exists()<\/code> \u306f\u540c\u671f\u95a2\u6570\u306a\u306e\u3067\u3001<code>tokio::fs::metadata<\/code> \u3092\u4f7f\u3044\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-rust\">#&lsqb;tauri::command&rsqb;\npub async fn file_exists(path: String) -&gt; Result&lt;bool, String&gt; {\n    match tokio::fs::metadata(&amp;path).await {\n        Ok(_) =&gt; Ok(true),\n        Err(e) if e.kind() == std::io::ErrorKind::NotFound =&gt; Ok(false),\n        Err(e) =&gt; Err(format!(&quot;\u30a8\u30e9\u30fc: {}&quot;, e)),\n    }\n}\n<\/code><\/pre>\n<h2 class=\"fz-xl\">3. tauri-plugin-store \u306e API \u5909\u66f4<\/h2>\n<p class=\"mt-1r\"><b class=\"fw-600\">\u75c7\u72b6<\/b><\/p>\n<pre><code class=\"language-\">Property &#39;defaults&#39; is missing in type &#39;{ autoSave: true; }&#39;\nbut required in type &#39;StoreOptions&#39;\n<\/code><\/pre>\n<p class=\"mt-1r\"><b class=\"fw-600\">\u539f\u56e0<\/b><\/p>\n<p><code>tauri-plugin-store<\/code> v2.2.0 \u3067 <code>load()<\/code> \u306e <code>defaults<\/code> \u30d1\u30e9\u30e1\u30fc\u30bf\u304c\u5fc5\u9808\u306b\u306a\u308a\u307e\u3057\u305f\u3002<\/p>\n<pre><code class=\"language-typescript\">\/\/ \u274c v2.2.0 \u3067\u306f\u30a8\u30e9\u30fc\nconst store = await load(&quot;settings.json&quot;, { autoSave: true });\n<\/code><\/pre>\n<p class=\"mt-1r\"><b class=\"fw-600\">\u89e3\u6c7a\u7b56<\/b><\/p>\n<p><code>defaults<\/code> \u3067\u30c7\u30d5\u30a9\u30eb\u30c8\u5024\u3092\u6307\u5b9a\u3059\u308b\u3002<\/p>\n<pre><code class=\"language-typescript\">\/\/ \u2705 defaults \u3092\u6307\u5b9a\nconst STORE_DEFAULTS = {\n  baseYmlPath: null,\n  autostartEnabled: false,\n  espansoAutostart: false,\n  espansoPath: null,\n};\n\nconst store = await load(&quot;settings.json&quot;, {\n  defaults: STORE_DEFAULTS,\n  autoSave: true,\n});\n<\/code><\/pre>\n<p class=\"mt-1r\"><b class=\"fw-600\">\u6559\u8a13<\/b><\/p>\n<ul style=\"list-style-type:bullet;\" class=\"mb-0.5r\">\n  <li>Tauri \u30d7\u30e9\u30b0\u30a4\u30f3\u306f\u983b\u7e41\u306b API \u304c\u5909\u308f\u308b<\/li>\n  <li>\u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u578b\u5b9a\u7fa9\u30d5\u30a1\u30a4\u30eb\u3092\u78ba\u8a8d\u3057\u3066\u304b\u3089\u4f7f\u3046<\/li>\n  <li><code>@tauri-apps\/api<\/code> \u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3068\u30d7\u30e9\u30b0\u30a4\u30f3\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3092\u5408\u308f\u305b\u308b<\/li>\n<\/ul>\n<h2 class=\"fz-xl\">4. CSS-in-JS \u3067 keyframes \u304c\u52b9\u304b\u306a\u3044<\/h2>\n<p class=\"mt-1r\"><b class=\"fw-600\">\u75c7\u72b6<\/b><\/p>\n<p>\u30a4\u30f3\u30e9\u30a4\u30f3\u30b9\u30bf\u30a4\u30eb\u3067 <code>animation: &quot;fadeIn 0.15s ease-out&quot;<\/code> \u3092\u6307\u5b9a\u3057\u3066\u3082\u3001\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u304c\u52d5\u304b\u306a\u3044\u3002<\/p>\n<p class=\"mt-1r\"><b class=\"fw-600\">\u539f\u56e0<\/b><\/p>\n<p>CSS-in-JS\uff08\u30a4\u30f3\u30e9\u30a4\u30f3\u30b9\u30bf\u30a4\u30eb\uff09\u3067\u306f <code>@keyframes<\/code> \u3092\u5b9a\u7fa9\u3067\u304d\u307e\u305b\u3093\u3002<code>animation<\/code> \u30d7\u30ed\u30d1\u30c6\u30a3\u306f keyframes \u540d\u3092\u53c2\u7167\u3059\u308b\u3060\u3051\u3067\u3001keyframes \u81ea\u4f53\u306f\u30b0\u30ed\u30fc\u30d0\u30eb CSS \u306b\u5b9a\u7fa9\u3059\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<pre><code class=\"language-typescript\">\/\/ \u274c keyframes \u304c\u306a\u3044\u306e\u3067\u30a2\u30cb\u30e1\u30fc\u30b7\u30e7\u30f3\u3057\u306a\u3044\n&lt;div style={{ animation: &quot;fadeIn 0.15s ease-out&quot; }}&gt;\n<\/code><\/pre>\n<p class=\"mt-1r\"><b class=\"fw-600\">\u89e3\u6c7a\u7b56<\/b><\/p>\n<p><code>useEffect<\/code> \u3067 <code>&lt;style&gt;<\/code> \u8981\u7d20\u3092\u6ce8\u5165\u3059\u308b\u3002<\/p>\n<pre><code class=\"language-typescript\">let keyframesInjected = false;\n\nfunction injectKeyframes() {\n  if (keyframesInjected) return;\n  const style = document.createElement(&quot;style&quot;);\n  style.textContent = `\n    @keyframes fadeIn {\n      from { opacity: 0; transform: translateY(-8px); }\n      to { opacity: 1; transform: translateY(0); }\n    }\n  `;\n  document.head.appendChild(style);\n  keyframesInjected = true;\n}\n\nexport function Toast({ toast }: Props) {\n  useEffect(() =&gt; {\n    injectKeyframes();\n  }, &lsqb;&rsqb;);\n\n  \/\/ ...\n}\n<\/code><\/pre>\n<p class=\"mt-1r\"><b class=\"fw-600\">\u5225\u306e\u9078\u629e\u80a2<\/b><\/p>\n<ul style=\"list-style-type:bullet;\" class=\"mb-0.5r\">\n  <li>\u30b0\u30ed\u30fc\u30d0\u30eb CSS \u30d5\u30a1\u30a4\u30eb\u306b keyframes \u3092\u5b9a\u7fa9\u3059\u308b<\/li>\n  <li>CSS Modules \u3092\u4f7f\u3046<\/li>\n  <li>Emotion \/ styled-components \u306a\u3069\u306e\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u3046<\/li>\n<\/ul>\n<h2 class=\"fz-xl\">5. invoke() \u306e\u30c6\u30b9\u30c8\u304c\u66f8\u304d\u306b\u304f\u3044<\/h2>\n<p class=\"mt-1r\"><b class=\"fw-600\">\u75c7\u72b6<\/b><\/p>\n<p>\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u3084 hooks \u304b\u3089 <code>invoke()<\/code> \u3092\u76f4\u63a5\u547c\u3076\u3068\u3001\u30c6\u30b9\u30c8\u6642\u306b\u30e2\u30c3\u30af\u3057\u306b\u304f\u3044\u3002<\/p>\n<p class=\"mt-1r\"><b class=\"fw-600\">\u89e3\u6c7a\u7b56<\/b>\uff1aTauriBridge \u30d1\u30bf\u30fc\u30f3<\/p>\n<p>\u4e3b\u8981\u306a <code>invoke()<\/code> \u30921\u3064\u306e\u30d5\u30a1\u30a4\u30eb\u306b\u307e\u3068\u3081\u3066\u3001\u578b\u4ed8\u304d\u30a2\u30af\u30bb\u30b5\u3092\u63d0\u4f9b\u3059\u308b\u3002<\/p>\n<pre><code class=\"language-typescript\">\/\/ src\/lib\/tauri-bridge.ts\nimport { invoke } from &quot;@tauri-apps\/api\/core&quot;;\n\nexport const TauriBridge = {\n  readFile: (path: string): Promise&lt;string&gt; =&gt;\n    invoke(&quot;read_file&quot;, { path }),\n\n  writeFile: (path: string, content: string): Promise&lt;void&gt; =&gt;\n    invoke(&quot;write_file&quot;, { path, content }),\n\n  fileExists: (path: string): Promise&lt;boolean&gt; =&gt;\n    invoke(&quot;file_exists&quot;, { path }),\n\n  \/\/ Tauri \u74b0\u5883\u5224\u5b9a\n  isTauri: (): boolean =&gt;\n    typeof window !== &quot;undefined&quot; &amp;&amp; &quot;__TAURI_INTERNALS__&quot; in window,\n};\n<\/code><\/pre>\n<p>hooks \u3084\u30b3\u30f3\u30dd\u30fc\u30cd\u30f3\u30c8\u306f <code>TauriBridge<\/code> \u7d4c\u7531\u3067\u547c\u3076\u3002<\/p>\n<pre><code class=\"language-typescript\">\/\/ src\/hooks\/useSnippets.ts\nimport { TauriBridge } from &quot;..\/lib\/tauri-bridge&quot;;\n\nconst loadFromPath = async (path: string) =&gt; {\n  const content = await TauriBridge.readFile(path);\n  \/\/ ...\n};\n<\/code><\/pre>\n<p>\u30c6\u30b9\u30c8\u6642\u306f\u30e2\u30c3\u30af\u3059\u308b\u3002<\/p>\n<pre><code class=\"language-typescript\">\/\/ tests\/useSnippets.test.ts\nvi.mock(&quot;..\/src\/lib\/tauri-bridge&quot;, () =&gt; ({\n  TauriBridge: {\n    readFile: vi.fn().mockResolvedValue(&quot;mock content&quot;),\n    writeFile: vi.fn().mockResolvedValue(undefined),\n    fileExists: vi.fn().mockResolvedValue(true),\n  },\n}));\n<\/code><\/pre>\n<p class=\"mt-1r\"><b class=\"fw-600\">\u30e1\u30ea\u30c3\u30c8<\/b><\/p>\n<ul style=\"list-style-type:bullet;\" class=\"mb-0.5r\">\n  <li>\u30c6\u30b9\u30c8\u6642\u306e\u30e2\u30c3\u30af\u304c\u7c21\u5358<\/li>\n  <li>\u578b\u5b89\u5168\u306a API<\/li>\n  <li>\u975e Tauri \u74b0\u5883\uff08\u30d6\u30e9\u30a6\u30b6\u958b\u767a\uff09\u3067\u306e\u30d5\u30a9\u30fc\u30eb\u30d0\u30c3\u30af\u304c\u66f8\u304d\u3084\u3059\u3044<\/li>\n<\/ul>\n<h2 class=\"fz-xl\">6. \u305d\u306e\u4ed6\u306e\u30cf\u30de\u308a\u30dd\u30a4\u30f3\u30c8<\/h2>\n<h3 class=\"fz-ml\">Rust \u30c6\u30b9\u30c8\u3067\u306e AppHandle \u4f9d\u5b58<\/h3>\n<p>Tauri \u30b3\u30de\u30f3\u30c9\u306f <code>AppHandle<\/code> \u306b\u4f9d\u5b58\u3059\u308b\u305f\u3081\u3001\u30e6\u30cb\u30c3\u30c8\u30c6\u30b9\u30c8\u304c\u66f8\u304d\u306b\u304f\u3044\u3002<\/p>\n<p class=\"mt-1r\"><b class=\"fw-600\">\u89e3\u6c7a\u7b56<\/b>: \u30ed\u30b8\u30c3\u30af\u3092\u7d14\u7c8b\u95a2\u6570\u3068\u3057\u3066\u5207\u308a\u51fa\u3059\u3002<\/p>\n<pre><code class=\"language-rust\">\/\/ \u2705 \u7d14\u7c8b\u95a2\u6570\u3068\u3057\u3066\u5207\u308a\u51fa\u3057\nfn build_default_base_yml_path() -&gt; Option&lt;String&gt; {\n    let home = dirs::home_dir()?;\n    \/\/ ...\n}\n\n#&lsqb;tauri::command&rsqb;\npub fn get_default_base_yml_path() -&gt; Result&lt;String, String&gt; {\n    build_default_base_yml_path()\n        .ok_or_else(|| &quot;\u30db\u30fc\u30e0\u30c7\u30a3\u30ec\u30af\u30c8\u30ea\u304c\u898b\u3064\u304b\u308a\u307e\u305b\u3093&quot;.to_string())\n}\n\n#&lsqb;cfg(test)&rsqb;\nmod tests {\n    use super::*;\n\n    #&lsqb;test&rsqb;\n    fn test_build_default_base_yml_path() {\n        let path = build_default_base_yml_path();\n        assert!(path.is_some());\n    }\n}\n<\/code><\/pre>\n<h3 class=\"fz-ml\">useEffect \u306e\u30af\u30ea\u30fc\u30f3\u30a2\u30c3\u30d7\u5fd8\u308c<\/h3>\n<p><code>setTimeout<\/code> \u3092\u4f7f\u3046 hooks \u3067\u3001unmount \u6642\u306b\u30bf\u30a4\u30de\u30fc\u3092\u30af\u30ea\u30a2\u3057\u306a\u3044\u3068\u30e1\u30e2\u30ea\u30ea\u30fc\u30af\u304c\u767a\u751f\u3059\u308b\u3002<\/p>\n<pre><code class=\"language-typescript\">\/\/ \u2705 cleanup \u3067\u30bf\u30a4\u30de\u30fc\u3092\u30af\u30ea\u30a2\nexport function useToast() {\n  const &lsqb;toast, setToast&rsqb; = useState&lt;Toast | null&gt;(null);\n  const timerRef = useRef&lt;number | null&gt;(null);\n\n  useEffect(() =&gt; {\n    return () =&gt; {\n      if (timerRef.current) {\n        clearTimeout(timerRef.current);\n      }\n    };\n  }, &lsqb;&rsqb;);\n\n  const showToast = (message: string, type: ToastType) =&gt; {\n    if (timerRef.current) clearTimeout(timerRef.current);\n    setToast({ message, type });\n    timerRef.current = window.setTimeout(() =&gt; setToast(null), 2200);\n  };\n\n  return { toast, showToast };\n}\n<\/code><\/pre>\n<h3 class=\"fz-ml\">label \u3068 input \u306e\u95a2\u9023\u4ed8\u3051<\/h3>\n<p><code>&lt;label&gt;<\/code> \u3068 <code>&lt;input&gt;<\/code> \u3092 <code>htmlFor<\/code> \/ <code>id<\/code> \u3067\u95a2\u9023\u4ed8\u3051\u306a\u3044\u3068\u3001\u30b9\u30af\u30ea\u30fc\u30f3\u30ea\u30fc\u30c0\u30fc\u304c\u30e9\u30d9\u30eb\u3092\u8aad\u307f\u4e0a\u3052\u306a\u3044\u3002<\/p>\n<pre><code class=\"language-typescript\">\/\/ \u2705 useId() \u3067\u4e00\u610fID\u3092\u751f\u6210\nimport { useId } from &quot;react&quot;;\n\nfunction TriggerInput({ value, onChange }: Props) {\n  const id = useId();\n  return (\n    &lt;div&gt;\n      &lt;label htmlFor={id}&gt;Trigger&lt;\/label&gt;\n      &lt;input id={id} value={value} onChange={onChange} \/&gt;\n    &lt;\/div&gt;\n  );\n}\n<\/code><\/pre>\n<h2 class=\"fz-xl\">\u307e\u3068\u3081<\/h2>\n<p>Tauri 2.x \u3067\u30c7\u30b9\u30af\u30c8\u30c3\u30d7\u30a2\u30d7\u30ea\u3092\u4f5c\u308b\u969b\u306e\u4e3b\u306a\u30cf\u30de\u308a\u30dd\u30a4\u30f3\u30c8\u3092\u307e\u3068\u3081\u307e\u3057\u305f\u3002<\/p>\n<table class=\"table tbl-responsive my-0.5r\">\n  <thead>\n    <tr class=\"rung\">\n      <th>\u554f\u984c<\/th>\n      <td>\u89e3\u6c7a\u7b56<\/td>\n    <\/tr>\n  <\/thead>\n  <tbody>\n    <tr class=\"rung\">\n      <th>.app \u304c\u8d77\u52d5\u3057\u306a\u3044<\/th>\n      <td>\u30d7\u30e9\u30b0\u30a4\u30f3\u8a2d\u5b9a\u306e\u578b\u3092\u78ba\u8a8d\u3001unit \u578b\u306b\u306f <code>{}<\/code> \u3092\u66f8\u304b\u306a\u3044<\/td>\n    <\/tr>\n    <tr class=\"rung\">\n      <th>async \u3067\u30d6\u30ed\u30c3\u30ad\u30f3\u30b0<\/th>\n      <td><code>tokio::fs<\/code> \u3092\u4f7f\u3046<\/td>\n    <\/tr>\n    <tr class=\"rung\">\n      <th>plugin-store \u30a8\u30e9\u30fc<\/th>\n      <td><code>defaults<\/code> \u30d1\u30e9\u30e1\u30fc\u30bf\u3092\u6307\u5b9a<\/td>\n    <\/tr>\n    <tr class=\"rung\">\n      <th>keyframes \u304c\u52b9\u304b\u306a\u3044<\/th>\n      <td>\u30b0\u30ed\u30fc\u30d0\u30eb CSS \u306b\u6ce8\u5165<\/td>\n    <\/tr>\n    <tr class=\"rung\">\n      <th>invoke \u306e\u30c6\u30b9\u30c8<\/th>\n      <td>TauriBridge \u30d1\u30bf\u30fc\u30f3\u3067\u96c6\u7d04<\/td>\n    <\/tr>\n  <\/tbody>\n<\/table>\n<p>Tauri \u306f Electron \u3088\u308a\u8efd\u91cf\u3067\u9ad8\u901f\u3067\u3059\u304c\u3001Rust + TypeScript \u306e\u4e21\u65b9\u3092\u6271\u3046\u5fc5\u8981\u304c\u3042\u308a\u3001\u30cf\u30de\u308a\u30dd\u30a4\u30f3\u30c8\u3082\u591a\u3044\u3067\u3059\u3002\u3053\u306e\u8a18\u4e8b\u304c\u53c2\u8003\u306b\u306a\u308c\u3070\u5e78\u3044\u3067\u3059\u3002<\/p>\n\n<h2 class=\"fz-xl\">\u53c2\u8003\u30ea\u30f3\u30af<\/h2>\n\n<ul style=\"list-style-type:bullet;\" class=\"mb-0.5r\">\n  <li><cite><a href=\"https:\/\/tauri.app\/\" class=\"link\" target=\"_blank\">Tauri 2.0 \u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8<\/a><\/cite><\/li>\n  <li><cite><a href=\"https:\/\/github.com\/tauri-apps\/plugins-workspace\/tree\/v2\/plugins\/store\" class=\"link\" target=\"_blank\">tauri-plugin-store<\/a><\/cite><\/li>\n  <li><cite><a href=\"https:\/\/github.com\/tauri-apps\/plugins-workspace\/tree\/v2\/plugins\/dialog\" class=\"link\" target=\"_blank\">tauri-plugin-dialog<\/a><\/cite><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"Tauri 2.x + React + TypeScript\u3067\u30c7\u30b9\u30af\u30c8\u30c3\u30d7\u30a2\u30d7\u30ea\u3092\u958b\u767a\u3057\u305f\u969b\u306e\u30cf\u30de\u308a\u30dd\u30a4\u30f3\u30c8\u3068\u89e3\u6c7a\u7b56\u3002.app\u304c\u8d77\u52d5\u3057\u306a\u3044\u30d7\u30e9\u30b0\u30a4\u30f3\u8a2d\u5b9a\u306e\u7f60\u3001async\u30b3\u30de\u30f3\u30c9\u3067\u306e\u30d6\u30ed\u30c3\u30ad\u30f3\u30b0I\/O\u3001tauri-plugin-store\u306eAPI\u5909\u66f4\u3001CSS-in-JS\u306ekeyframes\u554f\u984c\u306a\u3069\u5b9f\u4f8b\u3067\u89e3\u8aac\u3002","protected":false},"author":1,"featured_media":11081,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[17],"tags":[663,662,641,640,630,434,388,384,389,144],"group":[],"pg":[],"class_list":["post-11077","post","type-post","status-publish","format-standard","has-post-thumbnail","category-application","tag-tauri","tag-tauri2","tag-typescript","tag-react","tag-rust","tag-windows","tag-electron","tag-384","tag-389","tag-macos"],"acf":[],"_links":{"self":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts\/11077","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/comments?post=11077"}],"version-history":[{"count":0,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/posts\/11077\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/media\/11081"}],"wp:attachment":[{"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/media?parent=11077"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/categories?post=11077"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/tags?post=11077"},{"taxonomy":"group","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/group?post=11077"},{"taxonomy":"pg","embeddable":true,"href":"https:\/\/code-plus.jp\/gp\/wp-json\/wp\/v2\/pg?post=11077"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}