投稿時間:2022-09-11 15:09:03 RSSフィード2022-09-11 15:00 分まとめ(8件)
カテゴリー等 | サイト名等 | 記事タイトル・トレンドワード等 | リンクURL | 頻出ワード・要約等/検索ボリューム | 登録日 |
---|---|---|---|---|---|
AWS | lambdaタグが付けられた新着投稿 - Qiita | LocalStack ローカル環境でAWSを使おう | https://qiita.com/damepo9696/items/b3b38a4c64f76e10b0ac | httpslocalstac | 2022-09-11 14:35:28 |
AWS | AWSタグが付けられた新着投稿 - Qiita | LocalStack ローカル環境でAWSを使おう | https://qiita.com/damepo9696/items/b3b38a4c64f76e10b0ac | httpslocalstac | 2022-09-11 14:35:28 |
golang | Goタグが付けられた新着投稿 - Qiita | ゆめみ株式会社の採用試験をGoで解いてみた | https://qiita.com/heroheroheron/items/88e1d63bbae5db75e5b6 | 株式会社 | 2022-09-11 14:57:52 |
Git | Gitタグが付けられた新着投稿 - Qiita | 前にForkしてきたリポジトリが新しくなったので差分として自分のリポジトリに入れたい | https://qiita.com/misuzz/items/4e377ad057d66164234e | 自分 | 2022-09-11 14:19:26 |
Git | Gitタグが付けられた新着投稿 - Qiita | VScode起動時にopenSSHが出る場合の対処 | https://qiita.com/mash3-gt/items/ab2f356fc85b15aedc47 | github | 2022-09-11 14:04:43 |
海外TECH | DEV Community | Destructuring #React Quick Notes. | https://dev.to/ajaybaraiya6/destructuring-react-quick-notes-429e | Destructuring React Quick Notes Remember basic meaning It means choosing only desire sweets from a cakeshop Here is an example to remember it const cakeVarieties Chocolate KitKat Mango Brownie const myChoise myChoise rest cakeVarieties console log myChoise Chocolateconsole log myChoise KitKatconsole log rest Mango Brownie Remember rest means other things left and which is only be declared at last position Below is for React jsconst premiumCakeVarieties sameNameHere Chocolate sameNameHere KitKat sameNameHere fruitCakes Mango Pineaple sameNameHere Brownie const sameNameHere sameNameHere sameNameHere sameNameHere fruitCakes cake cake premiumCakeVarieties Notice We have same variable name no matter in which order they are they will access array property where matching name of itself console log sameNameHere Chocolateconsole log sameNameHere KitKatconsole log sameNameHere Brownieconsole log sameNameHere Mango Pineaple console log cake Mango this follows order here as we did not have key for itconsole log cake Pineaple this follows order here as we did not have key for itNotesWhile working with an Array we can destruct with defining array left side const a b rest here an array both sides While working with object we need brackets i e const a b rest obj here left side We only require this basics to work around although we can check over which has best detail explanation and can be used when we destruct more complex object But make all object simpler as possible | 2022-09-11 05:22:40 |
海外TECH | DEV Community | Setting Up Localization in your React App | https://dev.to/thesanjeevsharma/setting-up-localization-in-your-react-app-7 | Setting Up Localization in your React AppHey If your company or product is expanding into multiple geographies Localization is one of the most important things you will be working on The sooner you do it the better If you do the base setup in the initial stage it will make things easier as your codebase expands So how do we do it You ll have to spend few minutes reading this post I ll also leave the codesandbox link in the end for you to reference later To follow through you ll need basic understanding of React Context API We ll start by creating some translation files For this demo we ll support USA Spain and Russia All the strings in our codebase will lie in these files Next we need to setup a Locale context which will be consumed by our app tree But first let s create a constants file which will store geography related data We have everything we need to set up our context On line we define our initial state which is set to use English USA On line we create a reducer function which will modify the state On line we create the provider which will wrap our app tree I prefer using useReducer in context but the same could have been achieved by useState Before we end our work on the context it s good to create a custom hook to consume the context Now the final piece of the puzzle is to use this context by wrapping our app with it We can now refactor our app to use the locale strings This is how App js looks now This finishes our setup Now when we switch the region action is dispatched from this component which updates the file we re referring for translations Additionally we can store some data related to each geography and provide that through the context I ve added phone codes for each geography but you can expand it to keep whatever data you need for example addresses currencies etc Now we update context file to add a new key constants To use the constant let s add one more string to our translation files Finally updating our component to use this string I ve used this utility function name interpolate which is quite useful when working with translations Notice how in the phone text translation strings phoneCode lies at different positions for different geographies Also not everything can be hard coded in translations strings Sometimes you want to show some user data inside these strings That s exactly where interpolate helps interpolate looks for patterns we ve set inside in our strings and replaces those with actual data We can further extend interpolate to apply different styles to different substrings That s it This is how you set up localization Here s the codesandbox link I hope this post was helpful Follow for more Connect with me on LinkedIn or Twitter Cover image by Kalen Emsley | 2022-09-11 05:18:16 |
北海道 | 北海道新聞 | 海釣りの男性が死亡 枝幸 | https://www.hokkaido-np.co.jp/article/729422/ | 宗谷管内 | 2022-09-11 14:27:00 |
コメント
コメントを投稿