IT |
気になる、記になる… |
Anker、バッテリー搭載ポータブル冷蔵庫「Anker EverFrost Powered Cooler」の43Lモデルの一般販売を開始 |
https://taisy0.com/2023/05/16/171838.html
|
anker |
2023-05-16 11:32:22 |
IT |
ITmedia 総合記事一覧 |
[ITmedia News] レベル4の自動運転バス、2023年中に茨城県境町が導入へ エストニア製 |
https://www.itmedia.co.jp/news/articles/2305/16/news213.html
|
auvetech |
2023-05-16 20:30:00 |
IT |
ITmedia 総合記事一覧 |
[ITmedia News] 東電、電気代の値上げは平均15.9%に 6月から |
https://www.itmedia.co.jp/news/articles/2305/16/news210.html
|
itmedia |
2023-05-16 20:07:00 |
TECH |
Techable(テッカブル) |
概算見積もり額を自動で提案。商談を効率化する「ミツモリドットジェーピー」ローンチ |
https://techable.jp/archives/207030
|
souzoudo |
2023-05-16 11:00:13 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
【Python】ヴィジュネル暗号の実装 |
https://qiita.com/Takuya__/items/7acd17ef8a1a7927b45b
|
番号 |
2023-05-16 20:35:57 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
The Gate Pod |
https://qiita.com/thegatepod/items/93dd12d87a1acd473519
|
doanh |
2023-05-16 20:01:51 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
ブックマークレットでブラウザに便利機能を追加してみよう |
https://qiita.com/yusuke113/items/48afc10899287b169105
|
翻訳サイト |
2023-05-16 20:23:00 |
js |
JavaScriptタグが付けられた新着投稿 - Qiita |
chrome拡張機能開発でimportを使う簡単な例(webpack使用) |
https://qiita.com/Myuy973/items/fba026b02451a54965ec
|
chrome |
2023-05-16 20:15:04 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
Rubyにおけるmoduleのメソッド名衝突の挙動 |
https://qiita.com/xy2e45/items/a1fb446959c638a11980
|
module |
2023-05-16 20:13:44 |
AWS |
AWSタグが付けられた新着投稿 - Qiita |
クラウドセキュリティについて |
https://qiita.com/my_name_pochi/items/537f3e81c6fdccf791bf
|
顧客情報 |
2023-05-16 20:38:09 |
GCP |
gcpタグが付けられた新着投稿 - Qiita |
クラウドセキュリティについて |
https://qiita.com/my_name_pochi/items/537f3e81c6fdccf791bf
|
顧客情報 |
2023-05-16 20:38:09 |
Azure |
Azureタグが付けられた新着投稿 - Qiita |
クラウドセキュリティについて |
https://qiita.com/my_name_pochi/items/537f3e81c6fdccf791bf
|
顧客情報 |
2023-05-16 20:38:09 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
Rubyにおけるmoduleのメソッド名衝突の挙動 |
https://qiita.com/xy2e45/items/a1fb446959c638a11980
|
module |
2023-05-16 20:13:44 |
技術ブログ |
Developers.IO |
マルチ AZ が必須になった Amazon QuickSight VPC 接続の通信挙動を確認してみた |
https://dev.classmethod.jp/articles/quicksight-multi-az-vpc-failed/
|
amazonquicksightvpc |
2023-05-16 11:03:35 |
海外TECH |
DEV Community |
How Next.js Redirects Work |
https://dev.to/refine/how-nextjs-redirects-work-3j9p
|
How Next js Redirects WorkAuthor Michael Hungbo Uma IntroductionThe concept of URL redirection in web application development is one that is ubiquitous We experience it almost every time during our usage of the internet Think about the last time you were trying to sign up on a website and they asked you to sign up with Google Remember all the pop ups and redirects that happen before you re finally signed up to the website Yeah that s a typical example of URL redirection in web app development In this article we ll examine the concept of URL redirection in Next js you ll learn how Next js redirects work how to implement them in your next project and everything else you need to know about Next js redirects Now let s get started Steps we ll cover What is URL Redirection How to make redirects in Next jsMethods of Redirecting in Next js PrerequisitesBefore you continue with this article you ll need to have a Next js app or above running that you can use to try out the code examples in this article The app in this tutorial is bootstrapped with create next app What is URL Redirection URL Redirection is a technique used in web development for automatically changing the URL of a website from one to another Redirects are implemented in web development using the XX HTTP status codes For example a status code implies the URL you requested has moved permanently Some common use cases for performing URL redirects include Link shorteningUser authenticationA B TestingMarketing campaignsWebsite migrationWebsite maintenance or redesignThere are two most widely used methods of redirecting in web development Permanent redirection This method which uses a HTTP status code is used to indicate that a URL you re requesting has permanently moved to a new web address A good example to illustrate this is the Angelist Talent former website which now permanently redirects to Temporary redirection This method uses a HTTP status code to indicate a redirection from a specific URL to another for a limited duration of time For example if you re recreating your website or adopting a new brand design you can redirect your users to a different page to notify them about the update until the new website is up How to make redirects in Next jsNow that you understand what URL redirection is let s see how you can use the technique in your Next js app The most basic way to setup Next js redirects is to use the redirects key in your next config js file The Next js app created for us by create next app comes with a next config js file by default in the app root folder If you don t have the next config js file you can create it now in your root folder Next edit the content of app page js to the following export default function Home return lt gt lt main gt lt div gt This is the home page lt div gt lt main gt lt gt Now create a new folder named feed inside the app folder and create a page js in it like so app feed page js export default function Feed return lt h gt Hello welcome to your feed lt h gt Finally edit the content of next config js file in your app folder to this type import next NextConfig const nextConfig async redirects return source destination feed permanent true module exports nextConfigNow if you start the development server with npm run dev and navigate to http localhost instead of the app to render the home page in app page js you ll be redirected to the app feed page js page instead Here s how everything works behind the scenes The redirects key in next config js is an async function that returns array with objects for configuring redirects in your app You ll be using it most of the time to implement redirects in your Next js app In the above example we defined three objects source destination and permanent to implement the redirect The configuration objects are seven in total but the following three are required to perform any redirects source the original path the user requested destination the new path you want to route to permanent a boolean value When set to true it will utilize the status code instructing clients and search engines to cache the redirect indefinitely If set to false it will use the status code which is temporary and not cached While the following four are optional and only required for specific use cases basePath can be either false or undefined if set to false the basePath will not be considered during matching This can be useful for external redirects exclusively locale can be either false or undefined determines whether the locale should be excluded during matching has an array of has objects with the type key and value properties missing an array of missing objects with the type key and value properties Open source enterprise application platform for serious web developersrefine new enables you to create React based headless UI enterprise applications within your browser that you can preview tweak and download instantly By visually combining options for your preferred React platform UI framework backend connector and auth provider you can create tailor made architectures for your project in seconds It feels like having access to thousands of project templates at your fingertips allowing you to choose the one that best suits your needs Methods of Redirecting in Next jsNext js provides a variety of ways to perform redirects These include path matching header cookie and query matching API redirecting and so on Path matchingThis method involves the use of URL paths to configure how you want Next js to perform the redirect The example we used above is an example of using URL paths to configure Next js redirects const nextConfig async redirects return source destination feed permanent true module exports nextConfigThere are two methods we can use to match URL paths for redirects These are Matching URL path using wildcard patternsMatching URL path using Regular expressions Matching URL path using wildcard patternsYou can use wildcard patterns using asterisks to match one or more characters in the URL path For example a URL path such as user username will match any URLs that have the word user followed by any string such as user johndoe or user samurai The example below will redirect a user that tries to access say for example user johndoe to profile johndoe module exports async redirects return source user username destination profile username permanent true Matching URL path using Regular expressionsAnother way to configure Next js redirects is to use regex patterns to match the URL path To do this you can wrap the regex pattern in parentheses For example posts slug A Za z will match posts XRTwgFG but not posts FEE GRgtyy module exports async redirects return source posts slug A Za z destination articles slug permanent false Redirecting Based on Header Cookie and Query ValuesYou can also configure Next js redirects based on when the values of headers cookies or query match the source and has objects or don t match the missing object in next config js Note that for the redirect to take effect the values of source and has must match while the value of missing must not match The has and missing objects can have the following fields type a string value that must be either header cookie host or query key String the key from the selected type to match against value String or undefined the value to check for if undefined any value will match Let s look at an example that redirects the user to a different page in the app based on cookie value Edit the content of feed page js to the following use client import useEffect from react export default function Feed useEffect gt document cookie admin true SameSite None Secure console log document cookie return lt h gt Hello welcome to your feed lt h gt Next edit the content of next config js to the following const nextConfig async redirects return source feed has type cookie key admin value true destination permanent true module exports nextConfigIn the example above we are setting a cookie in feed page js immediately after the page renders Then we configure next config js to redirect the user from the feed page to the home page localhost based on the cookie value The has key checks if there s a cookie with a key value pair of admin true and then applies the redirect if so Redirecting with basePath supportThe basePath key allows you to prefix the URLs with a specific path For example if you want to redirect users to a new version of your docs with a different path and you don t want to write the new path repeatedly you can set the value of basePath in next config js like so const nextConfig basePath v async redirects return source v docs destination docs getting started permanent false module exports nextConfig Now when a user tries to visit the old docs at v docs getting started they will be redirected to v docs getting started instead And if you don t want the basePath to apply to a specific redirect you can set basePath to false like so const nextConfig basePath v async redirects return source v docs destination docs getting started permanent false source without basepath destination basePath is set to false here so this URL won t be prefixed with v basePath false permanent false module exports nextConfig Other Methods of Performing Next js Redirects In API RoutesApart from configuring redirects using the next config js file Next js provides other methods for doing this in different scenarios For example if you re building a full stack application using Next js API routes you can use the redirect method to make redirects import NextResponse from next server export async function GET request return NextResponse redirect In getServerSideProps and getStaticPropsexport default function Home return lt h gt Welcome to the home page lt h gt export const getServerSideProps async res gt return redirect destination new url permanent false ConclusionIn this article we looked at the several ways through which you can leverage Next js capabilities to easily configure redirects based on a variety of criteria including URL matching query parameters cookies headers and more Next js gives you a powerful and flexible system for handling redirects in your web applications Whether you re building a simple or complex application the methods discussed in this article are guaranteed to work for your use cases Happy coding |
2023-05-16 11:25:48 |
海外TECH |
DEV Community |
404 Page with React Router V6.4 |
https://dev.to/salehmubashar/404-page-with-react-router-v64-145j
|
Page with React Router VA page can be incredibly useful in improving user experience It is displayed when a user tries to access a page that does not exist on a website In this article we will explore two ways to implement a page using React Router V in our React application Check out this post on my blog too Method Suppose we have this basic route architecture lt Routes gt lt Route path element lt Home gt gt lt Route path blog element lt Blog gt gt lt Route path contact element lt Contact gt gt lt Routes gt If a user enters a path that matches one of the options mentioned above the respective component will be displayed To add the page we can create a new route that displays the page component for all paths This can be achieved by using an asterisk in the path As a result all paths will show the component except the custom routes we have defined lt Routes gt lt Route path element lt ErrorPage gt gt lt Route path element lt Home gt gt lt Route path blog element lt Blog gt gt lt Route path contact element lt Contact gt gt lt Routes gt Method React Router V introduces a new hook for error handling useRouteError Note This feature only works if using a data router Once you have a data router installed and running you can utilize useRouteError to catch any errors that occur during page loading or rendering including the error that occurs when a page is not found This makes debugging and error handling much simpler Firstly let s create an error page import useRouteError from react router dom export default function ErrorPage const error useRouteError return lt div gt lt p style color red fontSize px gt error status Page Not Found lt p gt lt div gt In order to display an appropriate message when a page is not found using the useRouteError hook you can simply receive the error from the hook and check its status If the status is you can return the appropriate message Similarly any other errors can be validated using this method Now we can implement this in our app Keep in mind that we are using the new data APIs introduced in React Router V We will use the createBrowserRouter and RouterProvider to create the routes import createBrowserRouter RouterProvider from react router dom import Home from Pages Home import Blog from Pages Blog import About from Pages About import ErrorPage from Extras ErrorPage const router createBrowserRouter path element lt Home gt path blog element lt Blog gt path about element lt About gt function App return lt RouterProvider router router gt export default App The architecture describe above works exactly like the usual Routes and Route approach We can now add the error page using errorElement in the root route const router createBrowserRouter path element lt Home gt errorElement lt ErrorPage gt path blog element lt Blog gt path about element lt About gt The final output will look like this Thanks for reading Check out my blog too |
2023-05-16 11:14:50 |
海外TECH |
Engadget |
The Morning After: This company will give you a free TV if you're willing to watch non-stop ads |
https://www.engadget.com/the-morning-after-this-company-will-give-you-a-free-tv-if-youre-willing-to-watch-non-stop-ads-112019031.html?src=rss
|
The Morning After This company will give you a free TV if you x re willing to watch non stop adsStartup Telly is now taking US reservations for free inch K TVs that continuously display ads on part of a secondary screen So long as you re willing to accept those ads or tune them out and share data you won t have to pay for the TV As Telly explains the smaller display also shows news sports scores and other useful data You won t have to interrupt a show just to stay in the know The set has its own camera microphone array sensors and voice assistant enabling video calls and motion captured fitness apps According to the image this secondary screen would be a long slender display that would live underneath the TV The reservations cover the first TVs which are expected to ship in the summer I m not sold on the idea I m getting stressful flashbacks of struggling to turn off those screens in the back of New York taxis addled by jetlag Mat SmithThe Morning After isn t just a newsletter it s also a daily podcast Get our daily audio briefings Monday through Friday by subscribing right here The biggest stories you might have missediPhone syncing for Windows is now available for everyoneJames Webb telescope finds water around a comet in the main asteroid belt The best iPhone accessories for The Apple Watch Ultra is almost off right nowTCL s new TVs deliver high frame rate gaming at lower prices The best smartwatches for Amazon is making a Lord of the Rings MMO gameThe creators of New World are behind the project AmazonAmazon has struck a deal with Embracer Group to release a massively multiplayer online MMO title based on the Lord of the Rings nbsp trilogy and The Hobbit Development is in the quot early stages quot at New World studio Amazon Games Orange County which will ship the game for PCs and consoles at an unspecified date Continue reading Google will pay Texas million to settle claims of deceptive Pixel adsThe payout comes after a deal with the federal government Google is still taking a financial hit over allegations it misled customers with Pixel ads The company has agreed to pay Texas million to settle claims it paid radio hosts for quot deceptive quot testimonials about the Pixel even though the DJs couldn t use the phone beforehand The ads continued even though Google was aware it was breaking the law Attorney General Ken Paxton said the state settlement was important as Google has quot significant influence quot and no large company should expect quot special treatment quot The tech giant already reached a million settlement with the Federal Trade Commission FTC and six other states Continue reading The EU approves Microsoft s billion Activision Blizzard takeoverThe deal still faces an uphill battle in the US and the UK As expected the European Union has rubberstamped Microsoft s bid to buy Activision Blizzard for billion The European Commission the EU s executive arm said Microsoft will have to ensure full compliance with the commitments it has made to offer its games on other platforms particularly cloud gaming services Activision does not yet offer its titles on cloud gaming services If Microsoft offered Activision games exclusively on its own cloud service that could have impaired competition the EU warned Continue reading Elon Musk loses appeal to tweet whatever he wants about TeslaThe SEC still wants a lawyer to approve some company related posts REUTERS Jonathan ErnstA federal appeals court in Manhattan has rebuffed Elon Musk s claim that the consent decree with the Securities and Exchange Commission SEC is an unfair quot prior restraint quot on his speech through Tesla tweets The CEO has fought with the SEC in the years since settling back in and more recently has been calling for courts to undo the settlement Musk claims the Commission pressured him to strike a deal and overstepped its authority The pact violated free speech rights Musk s side claimed A judge denied a request to cancel the deal last April prompting the appeal Continue reading This article originally appeared on Engadget at |
2023-05-16 11:20:19 |
海外TECH |
CodeProject Latest Articles |
How to Deploy Next.js to Firebase |
https://www.codeproject.com/Articles/5360871/How-to-Deploy-Next-js-to-Firebase
|
firebase |
2023-05-16 11:29:00 |
医療系 |
医療介護 CBnews |
【感染症情報】RSウイルス感染症が2週連続減少-インフルエンザも |
https://www.cbnews.jp/news/entry/20230516192052
|
医療機関 |
2023-05-16 20:10:00 |
ニュース |
BBC News - Home |
Record numbers not working due to ill health |
https://www.bbc.co.uk/news/business-65596283?at_medium=RSS&at_campaign=KARANGA
|
sickness |
2023-05-16 11:49:11 |
ニュース |
BBC News - Home |
Fraudsters jailed for selling fake passports to fugitive criminals |
https://www.bbc.co.uk/news/uk-65560640?at_medium=RSS&at_campaign=KARANGA
|
criminalspassports |
2023-05-16 11:53:18 |
ニュース |
BBC News - Home |
Man choked to death after paramedics told not to attend |
https://www.bbc.co.uk/news/uk-65597888?at_medium=RSS&at_campaign=KARANGA
|
order |
2023-05-16 11:05:08 |
ニュース |
BBC News - Home |
Javad Marandi: Tory donor's link to massive money laundering probe |
https://www.bbc.co.uk/news/uk-61264369?at_medium=RSS&at_campaign=KARANGA
|
donor |
2023-05-16 11:18:35 |
ニュース |
BBC News - Home |
Djokovic knocks Norrie out of Italian Open |
https://www.bbc.co.uk/sport/tennis/65609133?at_medium=RSS&at_campaign=KARANGA
|
cameron |
2023-05-16 11:55:52 |
ニュース |
Newsweek |
カヤック上で釣り動画を撮っていた男性、サメに襲われる |
https://www.newsweekjapan.jp/stories/world/2023/05/post-101648.php
|
カヤック上で釣り動画を撮っていた男性、サメに襲われる【動画】突如カヤックに噛み付いてくるイタチザメと絶叫する釣り人日の正午頃、ハワイ沖でカヤックフィッシングをしていた男性がイタチザメに襲われる事故が発生した。 |
2023-05-16 20:25:00 |
コメント
コメントを投稿