投稿時間:2021-07-18 01:18:47 RSSフィード2021-07-18 01:00 分まとめ(22件)

カテゴリー等 サイト名等 記事タイトル・トレンドワード等 リンクURL 頻出ワード・要約等/検索ボリューム 登録日
python Pythonタグが付けられた新着投稿 - Qiita Django勉強日記2 ~Windows10にUbuntu環境~ https://qiita.com/ebatyaso1228/items/f19879255c633520524d Django勉強日記WindowsにUbuntu環境はじめにちょっと最近環境構築トラブルなどありまして、Qiitaを開けてなかったです。 2021-07-18 00:18:07
js JavaScriptタグが付けられた新着投稿 - Qiita 【React】フロント初心者が公式チュートリアルをやってみた https://qiita.com/okaponta_/items/2f1878218d3142775d8b いよいよ、Reactの環境構築あとは、こちらを手順通りやっていけばOKです。 2021-07-18 00:38:18
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) cannot perform reduce with flexible type エラー https://teratail.com/questions/350021?rss=all cannotperformreducewithflexibletypeエラーnumpを使って二重リストの中の配列の要素の最小値を抜き出したいです。 2021-07-18 00:27:18
Program [全てのタグ]の新着質問一覧|teratail(テラテイル) Laravel8環境 @livewire('navigation-menu')をコピーするとUnable to find componentエラーになる https://teratail.com/questions/350020?rss=all Laravel環境livewirexnavigationmenuxをコピーするとUnabletofindcomponentエラーになるLaravelのLiveware環境でlayoutsを分けようとしています。 2021-07-18 00:07:19
AWS AWSタグが付けられた新着投稿 - Qiita Railsでvpc endpointを利用してsesからメールを送信する https://qiita.com/tomoronn3/items/dca628fb985b3d881372 Railsでvpcendpointを利用してsesからメールを送信する環境RubyRailsterraformやりたいことprivatesubnet内にあるECSfargateからAWSSESを利用してメールを送信するVPCendpointprivatesubnet内にecsインスタンスを作った場合NATgatwayなどを利用しないとAWSSESに接続できません。 2021-07-18 00:08:19
Docker dockerタグが付けられた新着投稿 - Qiita 【Mac】Cloud Native Buildpacksのpackコマンドをインストールする方法 https://qiita.com/keronori/items/533f10b58ab5363baa0d 英語が苦手な方は以下のサイトだけでも十分理解できると思います【公式】CloudNativeBuildpacks特性【公式】CloudNativeBuildpacksコンセプトCloudNativeBuildpackでめんどうなコンテナイメージ作成を自動化しようpackコマンドのインストールMacではbrewコマンドを使ってインストールすることができます。 2021-07-18 00:53:55
Docker dockerタグが付けられた新着投稿 - Qiita WindowsPCにDockerを導入 https://qiita.com/ytkayamura/items/b5d2547250f191194a83 cmdwsllvでWSLバージョン、ディストリビューションを確認。 2021-07-18 00:53:42
golang Goタグが付けられた新着投稿 - Qiita golangで始めるstate machine https://qiita.com/souhei-etou/items/5913089c6c496eb80e93 最後にチャットボットで利用する際は、初期位置を変えたstatemachineを毎回生成して、Eventを呼び出せばいけそうなのではと雑に考えてました。 2021-07-18 01:00:01
Ruby Railsタグが付けられた新着投稿 - Qiita Railsでvpc endpointを利用してsesからメールを送信する https://qiita.com/tomoronn3/items/dca628fb985b3d881372 Railsでvpcendpointを利用してsesからメールを送信する環境RubyRailsterraformやりたいことprivatesubnet内にあるECSfargateからAWSSESを利用してメールを送信するVPCendpointprivatesubnet内にecsインスタンスを作った場合NATgatwayなどを利用しないとAWSSESに接続できません。 2021-07-18 00:08:19
海外TECH Ars Technica The weekend’s best tech deals: Mass Effect, Jabra wireless earbuds, and more https://arstechnica.com/?p=1780828 chargers 2021-07-17 15:27:56
海外TECH DEV Community Abstracting with react hooks on LSD https://dev.to/patheticgeek/abstracting-with-react-hooks-on-lsd-15p Abstracting with react hooks on LSD The final one useBussinessLogic hookHooks are free of cost i e you can make them really easily and the only cost there is is the cost of abstraction A basic useTodos hookNow our components they don t always just interact with the local state most times they will be interacting with state on the server and managing async operations And that s where the lines get blurry So how about we put our hands in the magic pocket and try seeing if we have something that will help us Let s take an example of a basic to do app you d be having a list of to dos calling the APIs for getting it all that fun stuff so let s extract it in a hook const useTodos gt const todos useTodosStore const isLoading setIsLoading useState false const error setError useState null const fetchTodos useCallback async gt setIsLoading true try const data todos await axios get api todos setTodos todos setError null catch e setError e setIsLoading false useEffect gt fetchTodos fetchTodos return todos fetch fetchTodos isLoading false error null If we need to change something we can just change this small function and it works everywhere as long as it returns the same object Now we can just use this with one line of code wherever we want const App gt const todos isLoading error useTodos other stuff Mutating to dosNow let s say we want to toggle the state of a to do What do we do We just put or hands in the custom hooks doremon pocket and bring out useToggleTodoconst useToggleTodos gt const isLoading setIsLoading useState false const error setError useState null const toggleTodo useCallback async todoId gt setIsLoading true try const data await axios get api todos todoId toggle setError null setIsLoading false return data catch e setError e setIsLoading false return toggleTodo isLoading error But wait we also need to update things in our store and oh what about having multiple useTodos Do we have a global store or are all instances updated separately What about race condition And caching Doing it all rightRemember our custom hooks can use other hooks too so let s bring in useQuery from react queryimport useQuery from react query const fetchTodos gt axios get api todos then res gt res data const useTodos gt const data todos isLoading error useQuery todos fetchTodos return todos isLoading error And in our useToggleTodo we can use the useMutation from react query so that our to dos query is re fetched whenever we toggle a to doimport useMutation from react query const getToggleTodoById todoId gt axios get api todos todoId toggle const useToggleTodo gt return useMutation getToggleTodoById refetchQueries todos Look how we moved to using vanilla axios to react query in seconds and didn t have to change more than a couple of lines And now we have these nice hooks for our components to hooks into And my friends that how we use hooks and manage like a pro or from what all I know at least Now you can go show off your new shiny gadgets to your friends if you have any 2021-07-17 15:47:05
海外TECH DEV Community React state management on crack https://dev.to/patheticgeek/react-state-management-on-crack-55m8 React state management on crackEvery application needs some kind of state management Let s start with the most basic one and we will see how things change with scale Creating a basic global storeThe idea here is to have a useState that will store our state and update it and then we will use react context to pass it down to components So now we will create a new context named StoreContext and in its value the first item will be the store itself and the second item will be setStore so that we can update it import React createContext useContext useMemo useState from react const StoreContext createContext export const StoreProvider children initialState gt const store setStore useState initialState const contextValue useMemo gt store setStore store return lt StoreContext Provider value contextValue gt children lt StoreContext Provider gt export const useStore gt return useContext StoreContext export default StoreContext Some things don t seem rightThere s only so much growing your store can do with useState and at one point it will become a PIA to update your store using setStore So let s add a useReducer in here and now our code looks something like import React createContext useContext useMemo useReducer from react const StoreContext createContext export const StoreProvider children initialState reducer gt const store dispatch useReducer reducer initialState const contextValue useMemo gt store dispatch store return lt StoreContext Provider value contextValue gt children lt StoreContext Provider gt export const useStore gt return useContext StoreContext export default StoreContextThe problem with context is whenever it changes the whole tree under it re renders and that can be a huge performance issue So even if we are just dispatching an action our component will re render Now to fix that let s create a different context for storing the dispatch function and we will use it with a useDispatch hook import React createContext useContext useReducer from react const StoreContext createContext export const DispatchContext createContext export const StoreProvider initialState reducer children gt const store dispatch useReducer reducer initialState return lt DispatchContext Provider value dispatch gt lt StoreContext Provider value store gt children lt StoreContext Provider gt lt DispatchContext Provider gt export const useStore gt return useContext StoreContext export const useDispatch gt return useContext DispatchContext export default StoreContextAnd how we use this is by wrapping our App first in DispatchContext and then StoreContext and then in our componentimport React useRef from react import useDispatch useStore from state context reducer const Example gt const dispatch useDispatch const store useStore return lt div className my gt lt p gt JSON stringify store lt p gt lt button onClick gt dispatch type increment gt Dispatch lt button gt lt div gt export default Example One step furtherSo only one global state You might be wondering Rolls up my sleeves And here is where generator function comes in Basically we can make a function makeStore that takes in the reducer and initialState and gives us a provider a useStore and a useDispatch so that we can easily make multiple stores import React createContext useContext useReducer from react export default function makeStore reducer initialState const StoreContext createContext null const DispatchContext createContext null const StoreProvider children gt const store dispatch useReducer reducer initialState return lt DispatchContext Provider value dispatch gt lt StoreContext Provider value store gt children lt StoreContext Provider gt lt DispatchContext Provider gt const useStore gt return useContext StoreContext const useDispatch gt return useContext DispatchContext return StoreProvider useStore useDispatch And now we can make as many stores as we want const LayoutStore useLayout useLayoutDispatch makeStore layoutReducer menuOpen false const TodoStore useTodo useTodoDispatch makeStore todosReducer And now the cherry on topBut what about persistence You ask What about it I say and just add a few lines of code in our makeStore function export default function makeStore reducer initialState key const StoreContext createContext null const DispatchContext createContext null let finalInitialState null try finalInitialState JSON parse localStorage getItem key initialState catch e const finalReducer state action gt const newState reducer state action localStorage saveItem key JSON stringify newState return newState And now we use finalInitialState and finalReducer instead of reducer and initialState And this will give us persistence in all stores we make Hold on isn t this all client side Yes it is So in the next part let s see how we can connect our app to the server state and have it play well 2021-07-17 15:46:57
海外TECH DEV Community React hooks on steroids https://dev.to/patheticgeek/react-hooks-on-steroids-48l3 React hooks on steroids IntroductionThis isn t going to be just another hooks and context tutorial this is going to be me writing about how to do react hooks and state management like a pro And it can be a little too much to digest so grab your favourite snack and jump in This will be a series of three posts which will take your react hook and state skills as high as I am while writing this If you prefer to read it in long form here s the linkHold on if you don t know the basics of react hooks and react context API I highly recommend learning about them first Setting the stage with hooksSo we ve been using react s new functional components and hooks for a while now but how many of you have realized the actual power of hooks First we will look at some places where a custom hook might be good and how we implement one A basic useDarkMode hookSo we re coders we love dark themes but not everyone does so we need to have some theme state in our app We will use the window matchMedia to match a CSS media query which is prefers color scheme dark This will tell us if the user s system theme is dark or not and this will be our initial state const matchDark prefers color scheme dark const useDarkMode gt const isDark setIsDark useState gt if process browser return window matchMedia amp amp window matchMedia matchDark matches return false return isDark export default useDarkMode Making useDarkMode actually usefulNow some people man…they just can t decide if they want light or dark theme so they put it on auto And now we have to account for THAT in our applications How we do that is we can attach a listener to window matchMedia and listen for when it changes Now to do that in code…const matchDark prefers color scheme dark const useDarkMode gt const isDark setIsDark useState gt if process browser return window matchMedia amp amp window matchMedia matchDark matches return false useEffect gt const matcher window matchMedia matchDark const onChange matches MediaQueryListEvent gt setIsDark matches matcher addListener onChange return gt matcher removeListener onChange setIsDark return isDark export default useDarkModeAnd now how will be using this hook will look something likeimport useDarkMode from hooks useDarkMode const App gt const theme useDarkMode themes dark themes light return lt ThemeProvider value theme gt lt ThemeProvider gt Now pat yourself on the back You ve made a useful custom hook The hook most needed useInViewOne more common thing we often need is some way to detect if an element is in view or not Here most of us would find ourselves reaching for a library to do this but this is way simpler than it seems How to do this is simple We listen for scroll on windowWe get the bounding client rect of our element to get it s offset from topWe check if offset of element from top height of element is gt and if the offset from top of element is lt window s height if both are true then our element is visible If state is not correct then we set the state and call the onChange function if present const useInView elRef MutableRefObject lt HTMLElement null gt onChange inView boolean gt void gt const inView setInView useState false useEffect gt const onScroll gt if elRef current return const boundingRect elRef current getBoundingClientRect const elementHeight elRef current offsetHeight const offsetTop boundingRect top const windowHeight window innerHeight const isVisible offsetTop elementHeight gt amp amp offsetTop lt windowHeight if isVisible amp amp inView setInView isVisible onChange amp amp onChange isVisible else if isVisible amp amp inView setInView isVisible onChange amp amp onChange isVisible window addEventListener scroll onScroll return gt window removeEventListener scroll onScroll elRef onChange inView return inView Using this hook is as simple as creating itimport React useRef from react import useInView from hooks useInView const Hooks gt const elementRef useRef lt HTMLDivElement gt null use as a variable const inView useInView elementRef or use a callback useInView elementRef isInView gt console log isInView element has appeared element has disappeared return lt div className w full max w screen md gt lt div className h screen gt lt div gt lt div ref elementRef className py text center inView bg blue bg red gt Is in view inView true false lt div gt lt div className h screen gt lt div gt lt div gt export default HooksAnd now you can probably imagine all the places hooks can be useful In the next part we ll look at how to manage state in react apps without losing your sanity 2021-07-17 15:46:47
海外TECH DEV Community Характеристики качества требований https://dev.to/the_ba_girl/-1mgd ХарактеристикикачестватребованийЧтоделаеттребованияхорошими BABOK предоставляетдевятьхарактеристиккачестватребованийкПО можноиспользоватьих какчеклистпринаписанииилитестированиитребований АтомарностьПолнотаКраткостьКонсистентностьВыполнимостьПриоритизированностьТестируемостьНедвусмысленностьПонятностьДавайтерассмотримнекоторыекритериикачестваподробнее атакжеопределим какприблизитьсякидеалу АтомарностьАтомарноетребование этотакоетребование котороенельзяразбитьнаболеедетальныетребования которыеприэтомнепотеряютзавершенности тоесть требование чтоюзерможетзалогиниться введяимейлипароль нельзяразбитьна юзерстори пользовательскиеистории прополедляимейла поледляпароляикнопкувхода Почемуважно чтобытребованияксистемебылиатомарными Чтобы правильноприоритизировать сложноприоритизироватьюзерстори котораявключаетвсебясоздание редактированиеиудалениепоста Ноеслиразбитьеена становитсяуженамноголегче изэтогонаборавМВПявноможетвходитьневсё трассировать например ставязависимостьоточеньбольшоготребования вбудущемвозникаетпутаница откакойименночастизависимость легчеразрабатывать меньшевозможностейнапутать пропуститьчто то когдатребованиенебольшоеипростое требованиебыстреепопадетвтестирование да этооченьважно QA меняпоймут продолжитьчтениенасайте 2021-07-17 15:10:15
Apple AppleInsider - Frontpage News Mophie Snap+ Wireless Vent Mount review: Good iPhone car charger, but not quite MagSafe https://appleinsider.com/articles/21/07/17/mophie-snap-wireless-vent-mount-review-good-iphone-car-charger-but-not-quite-magsafe?utm_medium=rss Mophie Snap Wireless Vent Mount review Good iPhone car charger but not quite MagSafeMophie s MagSafe compatible Snap Wireless Vent Mount is a somewhat odd product offering an affordable magnetic puck that mimics Apple s own MagSafe charger but only at half the charging speed of the official accessory Mophie s Snap Wireless Vent Mount is unique as it ships with its own custom designed removable magnetic charging puck that works essentially the same as MagSafe just not as fast as Apple s own cable Using the puck and Snap magnetic adapter with an Android phone users will get up to watt wireless charging ーthe same as MagSafe But iPhone users aren t as lucky as standard Qi wireless charging on the iPhone is capped at watts Read more 2021-07-17 15:35:51
海外科学 NYT > Science Work Injuries Tied to Heat Are Vastly Undercounted, Study Finds https://www.nytimes.com/2021/07/15/climate/heat-injuries.html unexpected 2021-07-17 15:18:51
ニュース BBC News - Home Health Secretary Sajid Javid tests positive for Covid https://www.bbc.co.uk/news/uk-57874744 covidhe 2021-07-17 15:24:41
ニュース BBC News - Home Covid: Sunshine in Wales puts indoor meet-ups on hold https://www.bbc.co.uk/news/uk-wales-57875082 indoor 2021-07-17 15:51:04
ニュース BBC News - Home Covid: London's Metropolitan Line closed after staff pinged by NHS app https://www.bbc.co.uk/news/uk-england-london-57874404 appcontrol 2021-07-17 15:09:47
サブカルネタ ラーブロ 西尾中華そば@ラーメンWalkerキッチン(ところざわサクラタウン) 「辛口 ガリガリ中華そば」 http://feedproxy.google.com/~r/rablo/~3/j1mTVZ3bflQ/single_feed.php kadokawa 2021-07-17 16:01:11
サブカルネタ ラーブロ 葛西「KANDO」豚骨つけ麺 http://feedproxy.google.com/~r/rablo/~3/TPgVqX1hFLQ/single_feed.php kando 2021-07-17 16:00:54
北海道 北海道新聞 アフガン大使の娘を拉致、暴力も パキスタンに「深い懸念」 https://www.hokkaido-np.co.jp/article/568350/ 暴力 2021-07-18 00:12:00

コメント

このブログの人気の投稿

投稿時間:2021-06-17 05:05:34 RSSフィード2021-06-17 05:00 分まとめ(1274件)

投稿時間:2021-06-20 02:06:12 RSSフィード2021-06-20 02:00 分まとめ(3871件)

投稿時間:2020-12-01 09:41:49 RSSフィード2020-12-01 09:00 分まとめ(69件)