AWS |
AWS Marketplace |
Integrating Dropbox with AWS SSO for governed file sharing in an AWS Control Tower environment |
https://aws.amazon.com/blogs/awsmarketplace/integrating-dropbox-with-aws-sso-for-governed-file-sharing-in-an-aws-control-tower-environment/
|
Integrating Dropbox with AWS SSO for governed file sharing in an AWS Control Tower environmentThe customers who operate in multi account AWS environments often ask me for ways to simplify accessing critical business files and share content with their employees While my customers share the content between business groups or external business partners it is important to gain visibility and controls with minimum operational overhead Dropbox available in AWS Marketplace … |
2022-03-29 17:11:23 |
AWS |
AWS Machine Learning Blog |
Personalize cross-channel customer experiences with Amazon SageMaker, Amazon Personalize, and Twilio Segment |
https://aws.amazon.com/blogs/machine-learning/personalize-cross-channel-customer-experiences-with-amazon-sagemaker-amazon-personalize-and-segment/
|
Personalize cross channel customer experiences with Amazon SageMaker Amazon Personalize and Twilio SegmentToday customers interact with brands over an increasingly large digital and offline footprint generating a wealth of interaction data known as behavioral data As a result marketers and customer experience teams must work with multiple overlapping tools to engage and target those customers across touchpoints This increases complexity creates multiple views of each customer and … |
2022-03-29 17:41:54 |
AWS |
AWS - Webinar Channel |
Accelerate file-based workload migrations to AWS using Amazon FSx for NetApp ONTAP |
https://www.youtube.com/watch?v=v9rLjuWd6kI
|
netapp |
2022-03-29 17:43:55 |
技術ブログ |
Developers.IO |
CDKを使用して React アプリを Amplifyでデプロイしてみた。 |
https://dev.classmethod.jp/articles/deploy-react-app-amplify-using-cdk/
|
amplify |
2022-03-29 17:35:50 |
海外TECH |
Ars Technica |
Top Gun: Maverick’s final trailer sets up rivalry with Goose’s son |
https://arstechnica.com/?p=1844096
|
answers |
2022-03-29 17:13:11 |
海外TECH |
MakeUseOf |
5 Tips to Run Your Instagram Business Profile More Efficiently |
https://www.makeuseof.com/tips-run-business-instagram-profile-efficiently/
|
powerful |
2022-03-29 17:45:13 |
海外TECH |
MakeUseOf |
Crunchyroll Limits Free Streaming: What You'll Need to Keep Watching New Shows |
https://www.makeuseof.com/crunchyroll-limits-free-streaming/
|
showsfree |
2022-03-29 17:33:39 |
海外TECH |
MakeUseOf |
edX vs Coursera: Which Is the Best Learning Platform? |
https://www.makeuseof.com/edx-vs-coursera-best-learning-platform/
|
edX vs Coursera Which Is the Best Learning Platform If you re looking to sign up for a learning platform but aren t sure which to use look no further Here we ll compare edX and Coursera |
2022-03-29 17:30:14 |
海外TECH |
MakeUseOf |
Swapping Default Browsers in Windows 11 Just Got a Lot Easier |
https://www.makeuseof.com/windows-11-default-browser-switching-update/
|
button |
2022-03-29 17:19:35 |
海外TECH |
MakeUseOf |
The 7 Worst Features of Windows 11 |
https://www.makeuseof.com/windows-11-worst-features/
|
windows |
2022-03-29 17:15:14 |
海外TECH |
DEV Community |
How to Create a weather app using React.js |
https://dev.to/kavyargb/how-to-create-a-weather-app-using-reactjs-5adg
|
How to Create a weather app using React jsCreate a new folder and name it weather appUpdating to New ReleasesCreate React App is divided into two packages create react app is a global command line utility that you use to create new projects react scripts is a development dependency in the generated projects including this one You almost never need to update create react app itself it delegates all the setup to react scripts When you run create react app it always creates the project with the latest version of react scripts so you ll get all the new features and improvements in newly created apps automatically To update an existing project to a new version of react scripts open the changelog find the version you re currently on check package json in this folder if you re not sure and apply the migration instructions for the newer versions In most cases bumping the react scripts version in package json and running npm install in this folder should be enough but it s good to consult the changelog for potential breaking changes We commit to keeping the breaking changes minimal so you can upgrade react scripts painlessly Sending FeedbackWe are always open to your feedback Folder StructureAfter creation your project should look like this my app README md node modules package json public index html favicon ico src App css App js App test js index css index js logo svgFor the project to build these files must exist with exact filenames public index html is the page template src index js is the JavaScript entry point You can delete or rename the other files You may create subdirectories inside src For faster rebuilds only files inside src are processed by Webpack You need to put any JS and CSS files inside src otherwise Webpack won t see them Only files inside public can be used from public index html Read instructions below for using assets from JavaScript and HTML You can however create more top level directories They will not be included in the production build so you can use them for things like documentation Available ScriptsIn the project directory you can run npm startRuns the app in the development mode Open http localhost to view it in the browser The page will reload if you make edits You will also see any lint errors in the console npm testLaunches the test runner in the interactive watch mode See the section about running tests for more information npm run buildBuilds the app for production to the build folder It correctly bundles React in production mode and optimizes the build for the best performance The build is minified and the filenames include the hashes Your app is ready to be deployed See the section about deployment for more information npm run ejectNote this is a one way operation Once you eject you can t go back If you aren t satisfied with the build tool and configuration choices you can eject at any time This command will remove the single build dependency from your project Instead it will copy all the configuration files and the transitive dependencies Webpack Babel ESLint etc right into your project so you have full control over them All of the commands except eject will still work but they will point to the copied scripts so you can tweak them At this point you re on your own You don t have to ever use eject The curated feature set is suitable for small and middle deployments and you shouldn t feel obligated to use this feature However we understand that this tool wouldn t be useful if you couldn t customize it when you are ready for it Supported BrowsersBy default the generated project uses the latest version of React You can refer to the React documentation for more information about supported browsers Supported Language Features and PolyfillsThis project supports a superset of the latest JavaScript standard In addition to ES syntax features it also supports Exponentiation Operator ES Async await ES Object Rest Spread Properties stage proposal Dynamic import stage proposal Class Fields and Static Properties part of stage proposal JSX and Flow syntax Learn more about different proposal stages While we recommend using experimental proposals with some caution Facebook heavily uses these features in the product code so we intend to provide codemods if any of these proposals change in the future Note that the project only includes a few ES polyfills Object assign via object assign Promise via promise fetch via whatwg fetch If you use any other ES features that need runtime support such as Array from or Symbol make sure you are including the appropriate polyfills manually or that the browsers you are targeting already support them Also note that using some newer syntax features like for of or nonArrayValue causes Babel to emit code that depends on ES runtime features and might not work without a polyfill When in doubt use Babel REPL to see what any specific syntax compiles down to Syntax Highlighting in the EditorTo configure the syntax highlighting in your favorite text editor head to the relevant Babel documentation page and follow the instructions Some of the most popular editors are covered Displaying Lint Output in the EditorNote this feature is available with react scripts and higher It also only works with npm or higher Some editors including Sublime Text Atom and Visual Studio Code provide plugins for ESLint They are not required for linting You should see the linter output right in your terminal as well as the browser console However if you prefer the lint results to appear right in your editor there are some extra steps you can do You would need to install an ESLint plugin for your editor first Then add a file called eslintrc to the project root extends react app Now your editor should report the linting warnings Note that even if you edit your eslintrc file further these changes will only affect the editor integration They won t affect the terminal and in browser lint output This is because Create React App intentionally provides a minimal set of rules that find common mistakes If you want to enforce a coding style for your project consider using Prettier instead of ESLint style rules Debugging in the EditorThis feature is currently only supported by Visual Studio Code and WebStorm Visual Studio Code and WebStorm support debugging out of the box with Create React App This enables you as a developer to write and debug your React code without leaving the editor and most importantly it enables you to have a continuous development workflow where context switching is minimal as you don t have to switch between tools Visual Studio CodeYou would need to have the latest version of VS Code and VS Code Chrome Debugger Extension installed Then add the block below to your launch json file and put it inside the vscode folder in your app s root directory version configurations name Chrome type chrome request launch url http localhost webRoot workspaceRoot src sourceMapPathOverrides webpack src webRoot Note the URL may be different if you ve made adjustments via the HOST or PORT environment variables Start your app by running npm start and start debugging in VS Code by pressing F or by clicking the green debug icon You can now write code set breakpoints make changes to the code and debug your newly modified codeーall from your editor Having problems with VS Code Debugging Please see their troubleshooting guide WebStormYou would need to have WebStorm and JetBrains IDE Support Chrome extension installed In the WebStorm menu Run select Edit Configurations Then click and select JavaScript Debug Paste http localhost into the URL field and save the configuration Note the URL may be different if you ve made adjustments via the HOST or PORT environment variables Start your app by running npm start then press D on macOS or F on Windows and Linux or click the green debug icon to start debugging in WebStorm The same way you can debug your application in IntelliJ IDEA Ultimate PhpStorm PyCharm Pro and RubyMine Formatting Code AutomaticallyPrettier is an opinionated code formatter with support for JavaScript CSS and JSON With Prettier you can format the code you write automatically to ensure a code style within your project See the Prettier s GitHub page for more information and look at this page to see it in action To format our code whenever we make a commit in git we need to install the following dependencies npm install save husky lint staged prettierAlternatively you may use yarn yarn add husky lint staged prettierhusky makes it easy to use githooks as if they are npm scripts lint staged allows us to run scripts on staged files in git See this blog post about lint staged to learn more about it prettier is the JavaScript formatter we will run before commits Now we can make sure every file is formatted correctly by adding a few lines to the package json in the project root Add the following line to scripts section scripts precommit lint staged start react scripts start build react scripts build Next we add a lint staged field to the package json for example dependencies lint staged src js jsx json css prettier single quote write git add scripts Now whenever you make a commit Prettier will format the changed files automatically You can also run node modules bin prettier single quote write src js jsx to format your entire project for the first time Next you might want to integrate Prettier in your favorite editor Read the section on Editor Integration on the Prettier GitHub page Changing the Page You can find the source HTML file in the public folder of the generated project You may edit the tag in it to change the title from “React App to anything else Note that normally you wouldn t edit files in the public folder very often For example adding a stylesheet is done without touching the HTML If you need to dynamically update the page title based on the content you can use the browser document title API For more complex scenarios when you want to change the title from React components you can use React Helmet a third party library If you use a custom server for your app in production and want to modify the title before it gets sent to the browser you can follow advice in this section Alternatively you can pre build each page as a static HTML file which then loads the JavaScript bundle which is covered here Installing a DependencyThe generated project includes React and ReactDOM as dependencies It also includes a set of scripts used by Create React App as a development dependency You may install other dependencies for example React Router with npm npm install save react routerAlternatively you may use yarn yarn add react routerThis works for any library not just react router Importing a ComponentThis project setup supports ES modules thanks to Babel While you can still use require and module exports we encourage you to use import and export instead For example Button jsimport React Component from react class Button extends Component render export default Button Don t forget to use export default DangerButton jsimport React Component from react import Button from Button Import a component from another fileclass DangerButton extends Component render return export default DangerButton Be aware of the difference between default and named exports It is a common source of mistakes We suggest that you stick to using default imports and exports when a module only exports a single thing for example a component That s what you get when you use export default Button and import Button from Button Named exports are useful for utility modules that export several functions A module may have at most one default export and as many named exports as you like Learn more about ES modules When to use the curly braces Exploring ES ModulesUnderstanding ES ModulesCode SplittingInstead of downloading the entire app before users can use it code splitting allows you to split your code into small chunks which you can then load on demand This project setup supports code splitting via dynamic import Its proposal is in stage The import function like form takes the module name as an argument and returns a Promise which always resolves to the namespace object of the module Here is an example moduleA jsconst moduleA Hello export moduleA App jsimport React Component from react class App extends Component handleClick gt import moduleA then moduleA gt Use moduleA catch err gt Handle failure render return Load export default App This will make moduleA js and all its unique dependencies as a separate chunk that only loads after the user clicks the Load button You can also use it with async await syntax if you prefer it With React RouterIf you are using React Router check out this tutorial on how to use code splitting with it You can find the companion GitHub repository here Also check out the Code Splitting section in React documentation Adding a StylesheetThis project setup uses Webpack for handling all assets Webpack offers a custom way of “extending the concept of import beyond JavaScript To express that a JavaScript file depends on a CSS file you need to import the CSS from the JavaScript file Button css Button padding px Button jsimport React Component from react import Button css Tell Webpack that Button js uses these stylesclass Button extends Component render You can use them as regular CSS styles return This is not required for React but many people find this feature convenient You can read about the benefits of this approach here However you should be aware that this makes your code less portable to other build tools and environments than Webpack In development expressing dependencies this way allows your styles to be reloaded on the fly as you edit them In production all CSS files will be concatenated into a single minified css file in the build output If you are concerned about using Webpack specific semantics you can put all your CSS right into src index css It would still be imported from src index js but you could always remove that import if you later migrate to a different build tool Post Processing CSSThis project setup minifies your CSS and adds vendor prefixes to it automatically through Autoprefixer so you don t need to worry about it For example this App display flex flex direction row align items center becomes this App display webkit box display ms flexbox display flex webkit box orient horizontal webkit box direction normal ms flex direction row flex direction row webkit box align center ms flex align center align items center If you need to disable autoprefixing for some reason follow this section Adding a CSS Preprocessor Sass Less etc Generally we recommend that you don t reuse the same CSS classes across different components For example instead of using a Button CSS class in and components we recommend creating a component with its own Button styles that both and can render but not inherit Following this rule often makes CSS preprocessors less useful as features like mixins and nesting are replaced by component composition You can however integrate a CSS preprocessor if you find it valuable In this walkthrough we will be using Sass but you can also use Less or another alternative First let s install the command line interface for Sass npm install save node sass chokidarAlternatively you may use yarn yarn add node sass chokidarThen in package json add the following lines to scripts scripts build css node sass chokidar src o src watch css npm run build css amp amp node sass chokidar src o src watch recursive start react scripts start build react scripts build test react scripts test env jsdom Note To use a different preprocessor replace build css and watch css commands according to your preprocessor s documentation Now you can rename src App css to src App scss and run npm run watch css The watcher will find every Sass file in src subdirectories and create a corresponding CSS file next to it in our case overwriting src App css Since src App js still imports src App css the styles become a part of your application You can now edit src App scss and src App css will be regenerated To share variables between Sass files you can use Sass imports For example src App scss and other component style files could include import shared scss with variable definitions To enable importing files without using relative paths you can add the include path option to the command in package json build css node sass chokidar include path src include path node modules src o src watch css npm run build css amp amp node sass chokidar include path src include path node modules src o src watch recursive This will allow you to do imports like import styles colors scss assuming a styles directory under src import nprogress nprogress importing a css file from the nprogress node moduleAt this point you might want to remove all CSS files from the source control and add src css to your gitignore file It is generally a good practice to keep the build products outside of the source control As a final step you may find it convenient to run watch css automatically with npm start and run build css as a part of npm run build You can use the amp amp operator to execute two scripts sequentially However there is no cross platform way to run two scripts in parallel so we will install a package for this npm install save npm run allAlternatively you may use yarn yarn add npm run allThen we can change start and build scripts to include the CSS preprocessor commands scripts build css node sass chokidar src o src watch css npm run build css amp amp node sass chokidar src o src watch recursive start react scripts start build react scripts build start js react scripts start start npm run all p watch css start js build js react scripts build build npm run all build css build js test react scripts test env jsdom eject react scripts eject Now running npm start and npm run build also builds Sass files Why node sass chokidar node sass has been reported as having the following issues node sass watch has been reported to have performance issues in certain conditions when used in a virtual machine or with docker Infinite styles compiling node sass has been reported as having issues with detecting new files in a directory node sass chokidar is used here as it addresses these issues Adding Images Fonts and FilesWith Webpack using static assets like images and fonts works similarly to CSS You can import a file right in a JavaScript module This tells Webpack to include that file in the bundle Unlike CSS imports importing a file gives you a string value This value is the final path you can reference in your code e g as the src attribute of an image or the href of a link to a PDF To reduce the number of requests to the server importing images that are less than bytes returns a data URI instead of a path This applies to the following file extensions bmp gif jpg jpeg and png SVG files are excluded due to Here is an example import React from react import logo from logo png Tell Webpack this JS file uses this imageconsole log logo logo d pngfunction Header Import result is the URL of your image return export default Header This ensures that when the project is built Webpack will correctly move the images into the build folder and provide us with correct paths This works in CSS too Logo background image url logo png Webpack finds all relative module references in CSS they start with and replaces them with the final paths from the compiled bundle If you make a typo or accidentally delete an important file you will see a compilation error just like when you import a non existent JavaScript module The final filenames in the compiled bundle are generated by Webpack from content hashes If the file content changes in the future Webpack will give it a different name in production so you don t need to worry about long term caching of assets Please be advised that this is also a custom feature of Webpack It is not required for React but many people enjoy it and React Native uses a similar mechanism for images An alternative way of handling static assets is described in the next section Using the public FolderNote this feature is available with react scripts and higher Changing the HTMLThe public folder contains the HTML file so you can tweak it for example to set the page title The tag with the compiled code will be added to it automatically during the build process Adding Assets Outside of the Module SystemYou can also add other assets to the public folder Note that we normally encourage you to import assets in JavaScript files instead For example see the sections on adding a stylesheet and adding images and fonts This mechanism provides a number of benefits Scripts and stylesheets get minified and bundled together to avoid extra network requests Missing files cause compilation errors instead of errors for your users Result filenames include content hashes so you don t need to worry about browsers caching their old versions However there is an escape hatch that you can use to add an asset outside of the module system If you put a file into the public folder it will not be processed by Webpack Instead it will be copied into the build folder untouched To reference assets in the public folder you need to use a special variable called PUBLIC URL Inside index html you can use it like this Only files inside the public folder will be accessible by PUBLIC URL prefix If you need to use a file from src or node modules you ll have to copy it there to explicitly specify your intention to make this file a part of the build When you run npm run build Create React App will substitute PUBLIC URL with a correct absolute path so your project works even if you use client side routing or host it at a non root URL In JavaScript code you can use process env PUBLIC URL for similar purposes render Note this is an escape hatch and should be used sparingly Normally we recommend using import for getting asset URLs as described in “Adding Images and Fonts above this section return Keep in mind the downsides of this approach None of the files in public folder get post processed or minified Missing files will not be called at compilation time and will cause errors for your users Result filenames won t include content hashes so you ll need to add query arguments or rename them every time they change When to Use the public FolderNormally we recommend importing stylesheets images and fonts from JavaScript The public folder is useful as a workaround for a number of less common cases You need a file with a specific name in the build output such as manifest webmanifest You have thousands of images and need to dynamically reference their paths You want to include a small script like pace js outside of the bundled code Some library may be incompatible with Webpack and you have no other option but to include it as a tag lt br gt Note that if you add a lt script gt that declares global variables you also need to read the next section on using them lt p gt Using Global Variables lt br gt When you include a script in the HTML file that defines global variables and try to use one of these variables in the code the linter will complain because it cannot see the definition of the variable lt p gt lt p gt You can avoid this by reading the global variable explicitly from the window object for example lt p gt lt p gt const window lt br gt This makes it obvious you are using a global variable intentionally rather than because of a typo lt p gt lt p gt Alternatively you can force the linter to ignore any line by adding eslint disable line after it lt p gt lt p gt Adding Bootstrap lt br gt You don t have to use React Bootstrap together with React but it is a popular library for integrating Bootstrap with React apps If you need it you can integrate it with Create React App by following these steps lt p gt lt p gt Install React Bootstrap and Bootstrap from npm React Bootstrap does not include Bootstrap CSS so this needs to be installed as well lt p gt lt p gt npm install save react bootstrap bootstrap lt br gt Alternatively you may use yarn lt p gt lt p gt yarn add react bootstrap bootstrap lt br gt Import Bootstrap CSS and optionally Bootstrap theme CSS in the beginning of your src index js file lt p gt lt p gt import bootstrap dist css bootstrap css lt br gt import bootstrap dist css bootstrap theme css lt br gt Put any other imports below so that CSS from your lt br gt components takes precedence over default styles lt br gt Import required React Bootstrap components within src App js file or your custom component files lt p gt lt p gt import Navbar Jumbotron Button from react bootstrap lt br gt Now you are ready to use the imported React Bootstrap components within your component hierarchy defined in the render method Here is an example App js redone using React Bootstrap lt p gt lt p gt Using a Custom Theme lt br gt Sometimes you might need to tweak the visual styles of Bootstrap or equivalent package lt br gt We suggest the following approach lt p gt lt p gt Create a new package that depends on the package you wish to customize e g Bootstrap lt br gt Add the necessary build steps to tweak the theme and publish your package on npm lt br gt Install your own theme npm package as a dependency of your app lt br gt Here is an example of adding a customized Bootstrap that follows these steps lt p gt lt p gt Adding Flow lt br gt Flow is a static type checker that helps you write code with fewer bugs Check out this introduction to using static types in JavaScript if you are new to this concept lt p gt lt p gt Recent versions of Flow work with Create React App projects out of the box lt p gt lt p gt To add Flow to a Create React App project follow these steps lt p gt lt p gt Run npm install save flow bin or yarn add flow bin lt br gt Add flow flow to the scripts section of your package json lt br gt Run npm run flow init or yarn flow init to create a flowconfig file in the root directory lt br gt Add flow to any files you want to type check for example to src App js lt br gt Now you can run npm run flow or yarn flow to check the files for type errors You can optionally use an IDE like Nuclide for a better integrated experience In the future we plan to integrate it into Create React App even more closely lt p gt lt p gt To learn more about Flow check out its documentation lt p gt lt p gt Adding a Router lt br gt Create React App doesn t prescribe a specific routing solution but React Router is the most popular one lt p gt lt p gt To add it run lt p gt lt p gt npm install save react router dom lt br gt Alternatively you may use yarn lt p gt lt p gt yarn add react router dom lt br gt To try it delete all the code in src App js and replace it with any of the examples on its website The Basic Example is a good place to get started lt p gt lt p gt Note that you may need to configure your production server to support client side routing before deploying your app lt p gt lt p gt Adding Custom Environment Variables lt br gt Note this feature is available with lt a href mailto react scripts gt react scripts lt a gt and higher lt p gt lt p gt Your project can consume variables declared in your environment as if they were declared locally in your JS files By default you will have NODE ENV defined for you and any other environment variables starting with REACT APP lt p gt lt p gt The environment variables are embedded during the build time Since Create React App produces a static HTML CSS JS bundle it can t possibly read them at runtime To read them at runtime you would need to load HTML into memory on the server and replace placeholders in runtime just like described here Alternatively you can rebuild the app on the server anytime you change them lt p gt lt p gt Note You must create custom environment variables beginning with REACT APP Any other variables except NODE ENV will be ignored to avoid accidentally exposing a private key on the machine that could have the same name Changing any environment variables will require you to restart the development server if it is running lt p gt lt p gt These environment variables will be defined for you on process env For example having an environment variable named REACT APP SECRET CODE will be exposed in your JS as process env REACT APP SECRET CODE lt p gt lt p gt There is also a special built in environment variable called NODE ENV You can read it from process env NODE ENV When you run npm start it is always equal to development when you run npm test it is always equal to test and when you run npm run build to make a production bundle it is always equal to production You cannot override NODE ENV manually This prevents developers from accidentally deploying a slow development build to production lt p gt lt p gt These environment variables can be useful for displaying information conditionally based on where the project is deployed or consuming sensitive data that lives outside of version control lt p gt lt p gt First you need to have environment variables defined For example let s say you wanted to consume a secret defined in the environment inside a lt p gt lt form gt lt p gt render lt br gt return lt br gt lt p gt lt div gt lt br gt lt small gt You are running this application in lt b gt process env NODE ENV lt b gt mode lt small gt lt br gt lt form gt lt br gt lt input type hidden defaultvalue process env REACT APP SECRET CODE gt lt br gt lt form gt lt br gt lt div gt lt br gt lt br gt lt br gt During the build process env REACT APP SECRET CODE will be replaced with the current value of the REACT APP SECRET CODE environment variable Remember that the NODE ENV variable will be set for you automatically lt p gt When you load the app in the browser and inspect the lt input gt you will see its value set to abcdef and the bold text will show the environment provided when using npm start lt p gt lt div gt lt small gt You are running this application in lt b gt development lt b gt mode lt small gt lt form gt lt input type hidden value abcdef gt lt form gt lt div gt lt p gt The above form is looking for a variable called REACT APP SECRET CODE from the environment In order to consume this value we need to have it defined in the environment This can be done using two ways either in your shell or in a env file Both of these ways are described in the next few sections lt p gt lt p gt Having access to the NODE ENV is also useful for performing actions conditionally lt p gt lt p gt if process env NODE ENV production lt br gt analytics disable lt br gt lt br gt When you compile the app with npm run build the minification step will strip out this condition and the resulting bundle will be smaller lt p gt lt p gt Referencing Environment Variables in the HTML lt br gt Note this feature is available with lt a href mailto react scripts gt react scripts lt a gt and higher lt p gt lt p gt You can also access the environment variables starting with REACT APP in the public index html For example lt p gt lt p gt lt p gt lt title gt REACT APP WEBSITE NAME lt title gt lt br gt Note that the caveats from the above section apply lt p gt Apart from a few built in variables NODE ENV and PUBLIC URL variable names must start with REACT APP to work lt br gt The environment variables are injected at build time If you need to inject them at runtime follow this approach instead lt br gt Adding Temporary Environment Variables In Your Shell lt br gt Defining environment variables can vary between OSes It s also important to know that this manner is temporary for the life of the shell session lt p gt lt p gt Windows cmd exe lt br gt set REACT APP SECRET CODE abcdef amp amp amp amp npm start lt br gt Note Quotes around the variable assignment are required to avoid a trailing whitespace lt p gt lt p gt Windows Powershell lt br gt env REACT APP SECRET CODE abcdef and npm start lt br gt Linux macOS Bash lt br gt REACT APP SECRET CODE abcdef npm start lt br gt Adding Development Environment Variables In env lt br gt Note this feature is available with lt a href mailto react scripts gt react scripts lt a gt and higher lt p gt lt p gt To define permanent environment variables create a file called env in the root of your project lt p gt lt p gt REACT APP SECRET CODE abcdef lt br gt Note You must create custom environment variables beginning with REACT APP Any other variables except NODE ENV will be ignored to avoid accidentally exposing a private key on the machine that could have the same name Changing any environment variables will require you to restart the development server if it is running lt p gt lt p gt env files should be checked into source control with the exclusion of env local lt p gt lt p gt What other env files can be used lt br gt Note this feature is available with lt a href mailto react scripts gt react scripts lt a gt and higher lt p gt lt p gt env Default lt br gt env local Local overrides This file is loaded for all environments except test lt br gt env development env test env production Environment specific settings lt br gt env development local env test local env production local Local overrides of environment specific settings lt br gt Files on the left have more priority than files on the right lt p gt lt p gt npm start env development local env development env local env lt br gt npm run build env production local env production env local env lt br gt npm test env test local env test env note env local is missing lt br gt These variables will act as the defaults if the machine does not explicitly set them lt br gt Please refer to the dotenv documentation for more details lt p gt lt p gt Note If you are defining environment variables for development your CI and or hosting platform will most likely need these defined as well Consult their documentation how to do this For example see the documentation for Travis CI or Heroku lt p gt lt p gt Expanding Environment Variables In env lt br gt Note this feature is available with lt a href mailto react scripts gt react scripts lt a gt and higher lt p gt lt p gt Expand variables already on your machine for use in your env file using dotenv expand lt p gt lt p gt For example to get the environment variable npm package version lt p gt lt p gt REACT APP VERSION npm package version lt p gt lt h gt lt a name also works href also works class anchor gt lt a gt also works lt h gt lt h gt lt a name reactappversionnpmpackageversion href reactappversionnpmpackageversion class anchor gt lt a gt REACT APP VERSION npm package version lt h gt lt p gt Or expand variables local to the current env file lt p gt lt p gt DOMAIN lt a href gt www example com lt a gt lt br gt REACT APP FOO DOMAIN foo lt br gt REACT APP BAR DOMAIN bar lt br gt Can I Use Decorators lt br gt Many popular libraries use decorators in their documentation lt br gt Create React App doesn t support decorator syntax at the moment because lt p gt lt p gt It is an experimental proposal and is subject to change lt br gt The current specification version is not officially supported by Babel lt br gt If the specification changes we won t be able to write a codemod because we don t use them internally at Facebook lt br gt However in many cases you can rewrite decorator based code without decorators just as fine lt br gt Please refer to these two threads for reference lt p gt lt h gt lt a name href class anchor gt lt a gt lt h gt lt h gt lt a name href class anchor gt lt a gt lt h gt lt p gt Create React App will add decorator support when the specification advances to a stable stage lt p gt lt p gt Fetching Data with AJAX Requests lt br gt React doesn t prescribe a specific approach to data fetching but people commonly use either a library like axios or the fetch API provided by the browser Conveniently Create React App includes a polyfill for fetch so you can use it without worrying about the browser support lt p gt lt p gt The global fetch function allows to easily makes AJAX requests It takes in a URL as an input and returns a Promise that resolves to a Response object You can find more information about fetch here lt p gt lt p gt This project also includes a Promise polyfill which provides a full implementation of Promises A A Promise represents the eventual result of an asynchronous operation you can find more information about Promises here and here Both axios and fetch use Promises under the hood You can also use the async await syntax to reduce the callback nesting lt p gt lt p gt You can learn more about making AJAX requests from React components in the FAQ entry on the React website lt p gt lt p gt Integrating with an API Backend lt br gt These tutorials will help you to integrate your app with an API backend running on another port using fetch to access it lt p gt lt p gt Node lt br gt Check out this tutorial You can find the companion GitHub repository here lt p gt lt p gt Ruby on Rails lt br gt Check out this tutorial You can find the companion GitHub repository here lt p gt lt p gt Proxying API Requests in Development lt br gt Note this feature is available with lt a href mailto react scripts gt react scripts lt a gt and higher lt p gt lt p gt People often serve the front end React app from the same host and port as their backend implementation lt br gt For example a production setup might look like this after the app is deployed lt p gt lt p gt static server returns index html with React app lt br gt todos static server returns index html with React app lt br gt api todos server handles any api requests using the backend implementation lt br gt Such setup is not required However if you do have a setup like this it is convenient to write requests like fetch api todos without worrying about redirecting them to another host or port during development lt p gt lt p gt To tell the development server to proxy any unknown requests to your API server in development add a proxy field to your package json for example lt p gt lt p gt proxy lt a href http localhost gt http localhost lt a gt lt br gt This way when you fetch api todos in development the development server will recognize that it s not a static asset and will proxy your request to lt a href http localhost api todos gt http localhost api todos lt a gt as a fallback The development server will only attempt to send requests without text html in its Accept header to the proxy lt p gt lt p gt Conveniently this avoids CORS issues and error messages like this in development lt p gt lt p gt Fetch API cannot load lt a href http localhost api todos gt http localhost api todos lt a gt No Access Control Allow Origin header is present on the requested resource Origin lt a href http localhost gt http localhost lt a gt is therefore not allowed access If an opaque response serves your needs set the request s mode to no cors to fetch the resource with CORS disabled lt br gt Keep in mind that proxy only has effect in development with npm start and it is up to you to ensure that URLs like api todos point to the right thing in production You don t have to use the api prefix Any unrecognized request without a text html accept header will be redirected to the specified proxy lt p gt lt p gt The proxy option supports HTTP HTTPS and WebSocket connections lt br gt If the proxy option is not flexible enough for you alternatively you can lt p gt lt p gt Configure the proxy yourself lt br gt Enable CORS on your server here s how to do it for Express lt br gt Use environment variables to inject the right server host and port into your app lt br gt Invalid Host Header Errors After Configuring Proxy lt br gt When you enable the proxy option you opt into a more strict set of host checks This is necessary because leaving the backend open to remote hosts makes your computer vulnerable to DNS rebinding attacks The issue is explained in this article and this issue lt p gt lt p gt This shouldn t affect you when developing on localhost but if you develop remotely like described here you will see this error in the browser after enabling the proxy option lt p gt lt p gt Invalid Host header lt p gt lt p gt To work around it you can specify your public development host in a file called env development in the root of your project lt p gt lt p gt HOST mypublicdevhost com lt br gt If you restart the development server now and load the app from the specified host it should work lt p gt lt p gt If you are still having issues or if you re using a more exotic environment like a cloud editor you can bypass the host check completely by adding a line to env development local Note that this is dangerous and exposes your machine to remote code execution from malicious websites lt p gt lt h gt lt a name note this is dangerous href note this is dangerous class anchor gt lt a gt NOTE THIS IS DANGEROUS lt h gt lt h gt lt a name it exposes your machine to attacks from the websites you visit href it exposes your machine to attacks from the websites you visit class anchor gt lt a gt It exposes your machine to attacks from the websites you visit lt h gt lt p gt DANGEROUSLY DISABLE HOST CHECK true lt br gt We don t recommend this approach lt p gt lt p gt Configuring the Proxy Manually lt br gt Note this feature is available with lt a href mailto react scripts gt react scripts lt a gt and higher lt p gt lt p gt If the proxy option is not flexible enough for you you can specify an object in the following form in package json lt br gt You may also specify any configuration value http proxy middleware or http proxy supports lt p gt lt p gt lt br gt lt br gt proxy lt br gt api lt br gt target lt url gt lt br gt ws true lt br gt lt br gt lt br gt lt br gt lt br gt lt br gt All requests matching this path will be proxies no exceptions This includes requests for text html which the standard proxy option does not proxy lt url gt lt p gt lt p gt If you need to specify multiple proxies you may do so by specifying additional entries Matches are regular expressions so that you can use a regexp to match multiple paths lt p gt lt p gt lt br gt lt br gt proxy lt br gt Matches any request starting with api lt br gt api lt br gt target lt url gt lt br gt ws true lt br gt lt br gt lt br gt Matches any request starting with foo lt br gt foo lt br gt target lt url gt lt br gt ssl true lt br gt pathRewrite lt br gt foo foo beta lt br gt lt br gt lt br gt lt br gt Matches bar abc html but not bar sub def html lt br gt bar lt em gt html lt br gt target lt url gt lt br gt lt br gt lt br gt Matches baz abc html and baz sub def html lt br gt baz lt url gt lt em gt html lt br gt target lt url gt lt br gt lt br gt lt br gt lt br gt lt br gt lt br gt Configuring a WebSocket Proxy lt br gt When setting up a WebSocket proxy there are a some extra considerations to be aware of lt url gt lt url gt lt url gt lt p gt lt p gt If you re using a WebSocket engine like Socket io you must have a Socket io server running that you can use as the proxy target Socket io will not work with a standard WebSocket server Specifically don t expect Socket io to work with the websocket org echo test lt p gt lt p gt There s some good documentation available for setting up a Socket io server lt p gt lt p gt Standard WebSockets will work with a standard WebSocket server as well as the websocket org echo test You can use libraries like ws for the server with native WebSockets in the browser lt p gt lt p gt Either way you can proxy WebSocket requests manually in package json lt p gt lt p gt lt br gt lt br gt proxy lt br gt socket lt br gt Your compatible WebSocket server lt br gt target ws lt socket url gt lt br gt Tell http proxy middleware that this is a WebSocket proxy lt br gt Also allows you to proxy WebSocket requests without an additional HTTP request lt br gt lt a href external websocket upgrade gt external websocket upgrade lt a gt lt br gt ws true lt br gt lt br gt lt br gt lt br gt lt br gt lt br gt Using HTTPS in Development lt br gt Note this feature is available with lt a href mailto react scripts gt react scripts lt a gt and higher lt socket url gt lt p gt lt p gt You may require the dev server to serve pages over HTTPS One particular case where this could be useful is when using the proxy feature to proxy requests to an API server when that API server is itself serving HTTPS lt p gt lt p gt To do this set the HTTPS environment variable to true then start the dev server as usual with npm start lt p gt lt p gt Windows cmd exe lt br gt set HTTPS true amp amp amp amp npm start lt br gt Windows Powershell lt br gt env HTTPS true and npm start lt br gt Note the lack of whitespace is intentional lt p gt lt p gt Linux macOS Bash lt br gt HTTPS true npm start lt br gt Note that the server will use a self signed certificate so your web browser will almost definitely display a warning upon accessing the page lt p gt lt p gt Generating Dynamic lt meta gt Tags on the Server lt br gt Since Create React App doesn t support server rendering you might be wondering how to make lt meta gt tags dynamic and reflect the current URL To solve this we recommend to add placeholders into the HTML like this lt p gt lt p gt amp lt doctype html amp gt lt br gt lt br gt lt p gt lt br gt lt meta property og title content OG TITLE gt lt br gt lt meta property og description content OG DESCRIPTION gt lt br gt Then on the server regardless of the backend you use you can read index html into memory and replace lt strong gt OG TITLE lt strong gt lt strong gt OG DESCRIPTION lt strong gt and any other placeholders with values depending on the current URL Just make sure to sanitize and escape the interpolated values so that they are safe to embed into HTML lt p gt If you use a Node server you can even share the route matching logic between the client and the server However duplicating it also works fine in simple cases lt p gt lt p gt Pre Rendering into Static HTML Files lt br gt If you re hosting your build with a static hosting provider you can use react snapshot or react snap to generate HTML pages for each route or relative link in your application These pages will then seamlessly become active or “hydrated when the JavaScript bundle has loaded lt p gt lt p gt There are also opportunities to use this outside of static hosting to take the pressure off the server when generating and caching routes lt p gt lt p gt The primary benefit of pre rendering is that you get the core content of each page with the HTML payloadーregardless of whether or not your JavaScript bundle successfully downloads It also increases the likelihood that each route of your application will be picked up by search engines lt p gt lt p gt You can read more about zero configuration pre rendering also called snapshotting here lt p gt lt p gt Injecting Data from the Server into the Page lt br gt Similarly to the previous section you can leave some placeholders in the HTML that inject global variables for example lt p gt lt p gt amp lt doctype html amp gt lt br gt lt br gt lt p gt lt br gt lt script gt lt br gt window SERVER DATA lt strong gt SERVER DATA lt strong gt lt br gt lt div gt lt div gt lt div gt Then on the server you can replace SERVER DATA with a JSON of real data right before sending the response The client code can then read window SERVER DATA to use it Make sure to sanitize the JSON before sending it to the client as it makes your app vulnerable to XSS attacks Running TestsNote this feature is available with react scripts and higher Read the migration guide to learn how to enable it in older projects Create React App uses Jest as its test runner To prepare for this integration we did a major revamp of Jest so if you heard bad things about it years ago give it another try Jest is a Node based runner This means that the tests always run in a Node environment and not in a real browser This lets us enable fast iteration speed and prevent flakiness While Jest provides browser globals such as window thanks to jsdom they are only approximations of the real browser behavior Jest is intended to be used for unit tests of your logic and your components rather than the DOM quirks We recommend that you use a separate tool for browser end to end tests if you need them They are beyond the scope of Create React App Filename ConventionsJest will look for test files with any of the following popular naming conventions Files with js suffix in tests folders Files with test js suffix Files with spec js suffix The test js spec js files or the tests folders can be located at any depth under the src top level folder We recommend to put the test files or tests folders next to the code they are testing so that relative imports appear shorter For example if App test js and App js are in the same folder the test just needs to import App from App instead of a long relative path Colocation also helps find tests more quickly in larger projects Command Line InterfaceWhen you run npm test Jest will launch in the watch mode Every time you save a file it will re run the tests just like npm start recompiles the code The watcher includes an interactive command line interface with the ability to run all tests or focus on a search pattern It is designed this way so that you can keep it open and enjoy fast re runs You can learn the commands from the “Watch Usage note that the watcher prints after every run Jest watch modeVersion Control IntegrationBy default when you run npm test Jest will only run the tests related to files changed since the last commit This is an optimization designed to make your tests run fast regardless of how many tests you have However it assumes that you don t often commit the code that doesn t pass the tests Jest will always explicitly mention that it only ran tests related to the files changed since the last commit You can also press a in the watch mode to force Jest to run all tests Jest will always run all tests on a continuous integration server or if the project is not inside a Git or Mercurial repository Writing TestsTo create tests add it or test blocks with the name of the test and its code You may optionally wrap them in describe blocks for logical grouping but this is neither required nor recommended Jest provides a built in expect global function for making assertions A basic test could look like this import sum from sum it sums numbers gt expect sum toEqual expect sum toEqual All expect matchers supported by Jest are extensively documented here You can also use jest fn and expect fn toBeCalled to create “spies or mock functions Testing ComponentsThere is a broad spectrum of component testing techniques They range from a “smoke test verifying that a component renders without throwing to shallow rendering and testing some of the output to full rendering and testing component lifecycle and state changes Different projects choose different testing tradeoffs based on how often components change and how much logic they contain If you haven t decided on a testing strategy yet we recommend that you start with creating simple smoke tests for your components import React from react import ReactDOM from react dom import App from App it renders without crashing gt const div document createElement div ReactDOM render div This test mounts a component and makes sure that it didn t throw during rendering Tests like this provide a lot of value with very little effort so they are great as a starting point and this is the test you will find in src App test js When you encounter bugs caused by changing components you will gain a deeper insight into which parts of them are worth testing in your application This might be a good time to introduce more specific tests asserting specific expected output or behavior If you d like to test components in isolation from the child components they render we recommend using shallow rendering API from Enzyme To install it run npm install save enzyme enzyme adapter react react test rendererAlternatively you may use yarn yarn add enzyme enzyme adapter react react test rendererAs of Enzyme you will need to install Enzyme along with an Adapter corresponding to the version of React you are using The examples above use the adapter for React The adapter will also need to be configured in your global setup file src setupTests jsimport configure from enzyme import Adapter from enzyme adapter react configure adapter new Adapter Note Keep in mind that if you decide to eject before creating src setupTests js the resulting package json file won t contain any reference to it Read here to learn how to add this after ejecting Now you can write a smoke test with it import React from react import shallow from enzyme import App from App it renders without crashing gt shallow Unlike the previous smoke test using ReactDOM render this test only renders and doesn t go deeper For example even if itself renders a that throws this test will pass Shallow rendering is great for isolated unit tests but you may still want to create some full rendering tests to ensure the components integrate correctly Enzyme supports full rendering with mount and you can also use it for testing state changes and component lifecycle You can read the Enzyme documentation for more testing techniques Enzyme documentation uses Chai and Sinon for assertions but you don t have to use them because Jest provides built in expect and jest fn for spies Here is an example from Enzyme documentation that asserts specific output rewritten to use Jest matchers import React from react import shallow from enzyme import App from App it renders welcome message gt const wrapper shallow const welcome Welcome to React expect wrapper contains welcome to equal true expect wrapper contains welcome toEqual true All Jest matchers are extensively documented here Nevertheless you can use a third party assertion library like Chai if you want to as described below Additionally you might find jest enzyme helpful to simplify your tests with readable matchers The above contains code can be written more simply with jest enzyme expect wrapper toContainReact welcome To enable this install jest enzyme npm install save jest enzymeAlternatively you may use yarn yarn add jest enzymeImport it in src setupTests js to make its matchers available in every test import jest enzyme Using Third Party Assertion LibrariesWe recommend that you use expect for assertions and jest fn for spies If you are having issues with them please file those against Jest and we ll fix them We intend to keep making them better for React supporting for example pretty printing React elements as JSX However if you are used to other libraries such as Chai and Sinon or if you have existing code using them that you d like to port over you can import them normally like this import sinon from sinon import expect from chai and then use them in your tests like you normally do Initializing Test EnvironmentNote this feature is available with react scripts and higher If your app uses a browser API that you need to mock in your tests or if you just need a global setup before running your tests add a src setupTests js to your project It will be automatically executed before running your tests For example src setupTests jsconst localStorageMock getItem jest fn setItem jest fn clear jest fn global localStorage localStorageMockNote Keep in mind that if you decide to eject before creating src setupTests js the resulting package json file won t contain any reference to it so you should manually create the property setupTestFrameworkScriptFile in the configuration for Jest something like the following jest setupTestFrameworkScriptFile src setupTests js Focusing and Excluding TestsYou can replace it with xit to temporarily exclude a test from being executed Similarly fit lets you focus on a specific test without running any other tests Coverage ReportingJest has an integrated coverage reporter that works well with ES and requires no configuration Run npm test coverage note extra in the middle to include a coverage report like this coverage reportNote that tests run much slower with coverage so it is recommended to run it separately from your normal workflow ConfigurationThe default Jest coverage configuration can be overriden by adding any of the following supported keys to a Jest config in your package json Supported overrides collectCoverageFromcoverageReporterscoverageThresholdsnapshotSerializersExample package json name your package jest collectCoverageFrom src js jsx node modules path to dir coverageThreshold global branches functions lines statements coverageReporters text snapshotSerializers my serializer module Continuous IntegrationBy default npm test runs the watcher with interactive CLI However you can force it to run tests once and finish the process by setting an environment variable called CI When creating a build of your application with npm run build linter warnings are not checked by default Like npm test you can force the build to perform a linter warning check by setting the environment variable CI If any warnings are encountered then the build fails Popular CI servers already set the environment variable CI by default but you can do this yourself too On CI serversTravis CIFollowing the Travis Getting started guide for syncing your GitHub repository with Travis You may need to initialize some settings manually in your profile page Add a travis yml file to your git repository language node jsnode js cache directories node modulesscript npm run buildnpm testTrigger your first build with a git push Customize your Travis CI Build if needed CircleCIFollow this article to set up CircleCI with a Create React App project On your own environmentWindows cmd exe set CI true amp amp npm testset CI true amp amp npm run build Note the lack of whitespace is intentional Windows Powershell env CI true and npm test env CI true and npm run build Linux macOS Bash CI true npm testCI true npm run buildThe test command will force Jest to run tests once instead of launching the watcher If you find yourself doing this often in development please file an issue to tell us about your use case because we want to make watcher the best experience and are open to changing how it works to accommodate more workflows The build command will check for linter warnings and fail if any are found Disabling jsdomBy default the package json of the generated project looks like this scripts start react scripts start build react scripts build test react scripts test env jsdom If you know that none of your tests depend on jsdom you can safely remove env jsdom and your tests will run faster scripts start react scripts start build react scripts build test react scripts test env jsdom test react scripts test To help you make up your mind here is a list of APIs that need jsdom Any browser globals like window and documentReactDOM render TestUtils renderIntoDocument a shortcut for the above mount in EnzymeIn contrast jsdom is not needed for the following APIs TestUtils createRenderer shallow rendering shallow in EnzymeFinally jsdom is also not needed for snapshot testing Snapshot TestingSnapshot testing is a feature of Jest that automatically generates text snapshots of your components and saves them on the disk so if the UI output changes you get notified without manually writing any assertions on the component output Read more about snapshot testing Editor IntegrationIf you use Visual Studio Code there is a Jest extension which works with Create React App out of the box This provides a lot of IDE like features while using a text editor showing the status of a test run with potential fail messages inline starting and stopping the watcher automatically and offering one click snapshot updates VS Code Jest PreviewDebugging TestsThere are various ways to setup a debugger for your Jest tests We cover debugging in Chrome and Visual Studio Code Note debugging tests requires Node or higher Debugging Tests in ChromeAdd the following to the scripts section in your project s package json scripts test debug react scripts inspect brk test runInBand env jsdom Place debugger statements in any test and run npm run test debugThis will start running your Jest tests but pause before executing to allow a debugger to attach to the process Open the following in Chromeabout inspectAfter opening that link the Chrome Developer Tools will be displayed Select inspect on your process and a breakpoint will be set at the first line of the react script this is done simply to give you time to open the developer tools and to prevent Jest from executing before you have time to do so Click the button that looks like a play button in the upper right hand side of the screen to continue execution When Jest executes the test that contains the debugger statement execution will pause and you can examine the current scope and call stack Note the runInBand cli option makes sure Jest runs test in the same process rather than spawning processes for individual tests Normally Jest parallelizes test runs across processes but it is hard to debug many processes at the same time Debugging Tests in Visual Studio CodeDebugging Jest tests is supported out of the box for Visual Studio Code Use the following launch json configuration file version configurations name Debug CRA Tests type node request launch runtimeExecutable workspaceRoot node modules bin react scripts args test runInBand no cache env jsdom cwd workspaceRoot protocol inspector console integratedTerminal internalConsoleOptions neverOpen Developing Components in IsolationUsually in an app you have a lot of UI components and each of them has many different states For an example a simple button component could have following states In a regular state with a text label In the disabled mode In a loading state Usually it s hard to see these states without running a sample app or some examples Create React App doesn t include any tools for this by default but you can easily add Storybook for React source or React Styleguidist source to your project These are third party tools that let you develop components and see all their states in isolation from your app Storybook for React DemoYou can also deploy your Storybook or style guide as a static app This way everyone in your team can view and review different states of UI components without starting a backend server or creating an account in your app Getting Started with StorybookStorybook is a development environment for React UI components It allows you to browse a component library view the different states of each component and interactively develop and test components First install the following npm package globally npm install g storybook cliThen run the following command inside your app s directory getstorybookAfter that follow the instructions on the screen Learn more about React Storybook Screencast Getting Started with React StorybookGitHub RepoDocumentationSnapshot Testing UI with Storybook addon storyshotGetting Started with StyleguidistStyleguidist combines a style guide where all your components are presented on a single page with their props documentation and usage examples with an environment for developing components in isolation similar to Storybook In Styleguidist you write examples in Markdown where each code snippet is rendered as a live editable playground First install Styleguidist npm install save react styleguidistAlternatively you may use yarn yarn add react styleguidistThen add these scripts to your package json scripts styleguide styleguidist server styleguide build styleguidist build start react scripts start Then run the following command inside your app s directory npm run styleguideAfter that follow the instructions on the screen Learn more about React Styleguidist GitHub RepoDocumentationPublishing Components to npmCreate React App doesn t provide any built in functionality to publish a component to npm If you re ready to extract a component from your project so other people can use it we recommend moving it to a separate directory outside of your project and then using a tool like nwb to prepare it for publishing Making a Progressive Web AppBy default the production build is a fully functional offline first Progressive Web App Progressive Web Apps are faster and more reliable than traditional web pages and provide an engaging mobile experience All static site assets are cached so that your page loads fast on subsequent visits regardless of network connectivity such as G or G Updates are downloaded in the background Your app will work regardless of network state even if offline This means your users will be able to use your app at feet and on the subway On mobile devices your app can be added directly to the user s home screen app icon and all You can also re engage users using web push notifications This eliminates the need for the app store The sw precache webpack plugin is integrated into production configuration and it will take care of generating a service worker file that will automatically precache all of your local assets and keep them up to date as you deploy updates The service worker will use a cache first strategy for handling all requests for local assets including the initial HTML ensuring that your web app is reliably fast even on a slow or unreliable network Opting Out of CachingIf you would prefer not to enable service workers prior to your initial production deployment then remove the call to registerServiceWorker from src index js If you had previously enabled service workers in your production deployment and have decided that you would like to disable them for all your existing users you can swap out the call to registerServiceWorker in src index js first by modifying the service worker import import unregister from registerServiceWorker and then call unregister instead After the user visits a page that has unregister the service worker will be uninstalled Note that depending on how service worker js is served it may take up to hours for the cache to be invalidated Offline First ConsiderationsService workers require HTTPS although to facilitate local testing that policy does not apply to localhost If your production web server does not support HTTPS then the service worker registration will fail but the rest of your web app will remain functional Service workers are not currently supported in all web browsers Service worker registration won t be attempted on browsers that lack support The service worker is only enabled in the production environment e g the output of npm run build It s recommended that you do not enable an offline first service worker in a development environment as it can lead to frustration when previously cached assets are used and do not include the latest changes you ve made locally If you need to test your offline first service worker locally build the application using npm run build and run a simple http server from your build directory After running the build script create react app will give instructions for one way to test your production build locally and the deployment instructions have instructions for using other methods Be sure to always use an incognito window to avoid complications with your browser cache If possible configure your production environment to serve the generated service worker js with HTTP caching disabled If that s not possibleーGitHub Pages for instance does not allow you to change the default minute HTTP cache lifetimeーthen be aware that if you visit your production site and then revisit again before service worker js has expired from your HTTP cache you ll continue to get the previously cached assets from the service worker If you have an immediate need to view your updated production deployment performing a shift refresh will temporarily disable the service worker and retrieve all assets from the network Users aren t always familiar with offline first web apps It can be useful to let the user know when the service worker has finished populating your caches showing a This web app works offline message and also let them know when the service worker has fetched the latest updates that will be available the next time they load the page showing a New content is available please refresh message Showing this messages is currently left as an exercise to the developer but as a starting point you can make use of the logic included in src registerServiceWorker js which demonstrates which service worker lifecycle events to listen for to detect each scenario and which as a default just logs appropriate messages to the JavaScript console By default the generated service worker file will not intercept or cache any cross origin traffic like HTTP API requests images or embeds loaded from a different domain If you would like to use a runtime caching strategy for those requests you can eject and then configure the runtimeCaching option in the SWPrecacheWebpackPlugin section of webpack config prod js Progressive Web App MetadataThe default configuration includes a web app manifest located at public manifest json that you can customize with details specific to your web application When a user adds a web app to their homescreen using Chrome or Firefox on Android the metadata in manifest json determines what icons names and branding colors to use when the web app is displayed The Web App Manifest guide provides more context about what each field means and how your customizations will affect your users experience Analyzing the Bundle SizeSource map explorer analyzes JavaScript bundles using the source maps This helps you understand where code bloat is coming from To add Source map explorer to a Create React App project follow these steps npm install save source map explorerAlternatively you may use yarn yarn add source map explorerThen in package json add the following line to scripts scripts analyze source map explorer build static js main start react scripts start build react scripts build test react scripts test env jsdom Then to analyze the bundle run the production build then run the analyze script npm run buildnpm run analyzeDeploymentnpm run build creates a build directory with a production build of your app Set up your favorite HTTP server so that a visitor to your site is served index html and requests to static paths like static js main js are served with the contents of the static js main js file Static ServerFor environments using Node the easiest way to handle this would be to install serve and let it handle the rest npm install g serveserve s buildThe last command shown above will serve your static site on the port Like many of serve s internal settings the port can be adjusted using the p or port flags Run this command to get a full list of the options available serve hOther SolutionsYou don t necessarily need a static server in order to run a Create React App project in production It works just as fine integrated into an existing dynamic one Here s a programmatic example using Node and Express const express require express const path require path const app express app use express static path join dirname build app get function req res res sendFile path join dirname build index html app listen The choice of your server software isn t important either Since Create React App is completely platform agnostic there s no need to explicitly use Node The build folder with static assets is the only output produced by Create React App However this is not quite enough if you use client side routing Read the next section if you want to support URLs like todos in your single page app Serving Apps with Client Side RoutingIf you use routers that use the HTML pushState history API under the hood for example React Router with browserHistory many static file servers will fail For example if you used React Router with a route for todos the development server will respond to localhost todos properly but an Express serving a production build as above will not This is because when there is a fresh page load for a todos the server looks for the file build todos and does not find it The server needs to be configured to respond to a request to todos by serving index html For example we can amend our Express example above to serve index html for any unknown paths app use express static path join dirname build app get function req res app get function req res res sendFile path join dirname build index html If you re using Apache HTTP Server you need to create a htaccess file in the public folder that looks like this Options MultiViewsRewriteEngine OnRewriteCond REQUEST FILENAME fRewriteRule index html QSA L It will get copied to the build folder when you run npm run build If you re using Apache Tomcat you need to follow this Stack Overflow answer Now requests to todos will be handled correctly both in development and in production On a production build and in a browser that supports service workers the service worker will automatically handle all navigation requests like for todos by serving the cached copy of your index html This service worker navigation routing can be configured or disabled by ejecting and then modifying the navigateFallback and navigateFallbackWhitelist options of the SWPreachePlugin configuration When users install your app to the homescreen of their device the default configuration will make a shortcut to index html This may not work for client side routers which expect the app to be served from Edit the web app manifest at public manifest json and change start url to match the required URL scheme for example start url Building for Relative PathsBy default Create React App produces a build assuming your app is hosted at the server root To override this specify the homepage in your package json for example homepage This will let Create React App correctly infer the root path to use in the generated HTML file Note If you are using react router you can root s using the basename prop on any More information here For example renders Serving the Same Build from Different PathsNote this feature is available with react scripts and higher If you are not using the HTML pushState history API or not using client side routing at all it is unnecessary to specify the URL from which your app will be served Instead you can put this in your package json homepage This will make sure that all the asset paths are relative to index html You will then be able to move your app from to or even without having to rebuild it AzureSee this blog post on how to deploy your React app to Microsoft Azure See this blog post or this repo for a way to use automatic deployment to Azure App Service FirebaseInstall the Firebase CLI if you haven t already by running npm install g firebase tools Sign up for a Firebase account and create a new project Run firebase login and login with your previous created Firebase account Then run the firebase init command from your project s root You need to choose the Hosting Configure and deploy Firebase Hosting sites and choose the Firebase project you created in the previous step You will need to agree with database rules json being created choose build as the public directory and also agree to Configure as a single page app by replying with y Project SetupFirst let s associate this project directory with a Firebase project You can create multiple project aliases by running firebase use add but for now we ll just set up a default project What Firebase project do you want to associate as default Example app example app fd Database SetupFirebase Realtime Database Rules allow you to define how your data should bestructured and when your data can be read from and written to What file should be used for Database Rules database rules jsonDatabase Rules for example app fd have been downloaded to database rules json Future modifications to database rules json will update Database Rules when you runfirebase deploy Hosting SetupYour public directory is the folder relative to your project directory thatwill contain Hosting assets to uploaded with firebase deploy If youhave a build process for your assets use your build s output directory What do you want to use as your public directory build Configure as a single page app rewrite all urls to index html YesWrote build index htmli Writing configuration info to firebase json i Writing project information to firebaserc Firebase initialization complete IMPORTANT you need to set proper HTTP caching headers for service worker js file in firebase json file or you will not be able to see changes after first deployment issue It should be added inside hosting key like next hosting headers source service worker js headers key Cache Control value no cache Now after you create a production build with npm run build you can deploy it by running firebase deploy Deploying to example app fd i deploying database hostingdatabase rules ready to deploy i hosting preparing build directory for upload Uploading hosting build folder uploaded successfullyhosting files uploaded successfullyi starting release process may take several minutes Deploy complete Project Console Hosting URL For more information see Add Firebase to your JavaScript Project GitHub PagesNote this feature is available with react scripts and higher Step Add homepage to package jsonThe step below is important If you skip it your app will not deploy correctly Open your package json and add a homepage field for your project homepage or for a GitHub user page homepage Create React App uses the homepage field to determine the root URL in the built HTML file Step Install gh pages and add deploy to scripts in package jsonNow whenever you run npm run build you will see a cheat sheet with instructions on how to deploy to GitHub Pages To publish it at run npm install save gh pagesAlternatively you may use yarn yarn add gh pagesAdd the following scripts in your package json scripts predeploy npm run build deploy gh pages d build start react scripts start build react scripts build The predeploy script will run automatically before deploy is run If you are deploying to a GitHub user page instead of a project page you ll need to make two additional modifications First change your repository s source branch to be any branch other than master Additionally tweak your package json scripts to push deployments to master scripts predeploy npm run build deploy gh pages d build deploy gh pages b master d build Step Deploy the site by running npm run deployThen run npm run deployStep Ensure your project s settings use gh pagesFinally make sure GitHub Pages option in your GitHub project settings is set to use the gh pages branch gh pages branch settingStep Optionally configure the domainYou can configure a custom domain with GitHub Pages by adding a CNAME file to the public folder Notes on client side routingGitHub Pages doesn t support routers that use the HTML pushState history API under the hood for example React Router using browserHistory This is because when there is a fresh page load for a url like where todos is a frontend route the GitHub Pages server returns because it knows nothing of todos If you want to add a router to a project hosted on GitHub Pages here are a couple of solutions You could switch from using HTML history API to routing with hashes If you use React Router you can switch to hashHistory for this effect but the URL will be longer and more verbose for example todos k yknaj Read more about different history implementations in React Router Alternatively you can use a trick to teach GitHub Pages to handle by redirecting to your index html page with a special redirect parameter You would need to add a html file with the redirection code to the build folder before deploying your project and you ll need to add code handling the redirect parameter to index html You can find a detailed explanation of this technique in this guide HerokuUse the Heroku Buildpack for Create React App You can find instructions in Deploying React with Zero Configuration Resolving Heroku Deployment ErrorsSometimes npm run build works locally but fails during deploy via Heroku Following are the most common cases Module not found Error Cannot resolve file or directory If you get something like this remote Failed to create a production build Reason remote Module not found Error Cannot resolve file or directory MyDirectory in tmp build srcIt means you need to ensure that the lettercase of the file or directory you import matches the one you see on your filesystem or on GitHub This is important because Linux the operating system used by Heroku is case sensitive So MyDirectory and mydirectory are two distinct directories and thus even though the project builds locally the difference in case breaks the import statements on Heroku remotes Could not find a required file If you exclude or ignore necessary files from the package you will see a error similar this one remote Could not find a required file remote Name index htmlremote Searched in tmp build afcbdfddf publicremote remote npm ERR Linux genericremote npm ERR argv tmp build afcbdfddf heroku node bin node tmp build afcbdfddf heroku node bin npm run build In this case ensure that the file is there with the proper lettercase and that s not ignored on your local gitignore or gitignore global NetlifyTo do a manual deploy to Netlify s CDN npm install netlify cli gnetlify deployChoose build as the path to deploy To setup continuous delivery With this setup Netlify will build and deploy when you push to git or open a pull request Start a new netlify projectPick your Git hosting service and select your repositoryClick Build your siteSupport for client side routing To support pushState make sure to create a public redirects file with the following rewrite rules index html When you build the project Create React App will place the public folder contents into the build output NowNow offers a zero configuration single command deployment You can use now to deploy your app for free Install the now command line tool either via the recommended desktop tool or via node with npm install g now Build your app by running npm run build Move into the build directory by running cd build Run now name your project name from within the build directory You will see a now sh URL in your output like this Ready copied to clipboard Paste that URL into your browser when the build is complete and you will see your deployed app Details are available in this article S and CloudFrontSee this blog post on how to deploy your React app to Amazon Web Services S and CloudFront SurgeInstall the Surge CLI if you haven t already by running npm install g surge Run the surge command and log in you or create a new account When asked about the project path make sure to specify the build folder for example project path path to project buildNote that in order to support routers that use HTML pushState API you may want to rename the index html in your build folder to html before deploying to Surge This ensures that every URL falls back to that file Advanced ConfigurationYou can adjust various development and production settings by setting environment variables in your shell or with env Variable Development Production UsageBROWSER By default Create React App will open the default system browser favoring Chrome on macOS Specify a browser to override this behavior or set it to none to disable it completely If you need to customize the way the browser is launched you can specify a node script instead Any arguments passed to npm start will also be passed to this script and the url where your app is served will be the last argument Your script s file name must have the js extension HOST By default the development web server binds to localhost You may use this variable to specify a different host PORT By default the development web server will attempt to listen on port or prompt you to attempt the next available port You may use this variable to specify a different port HTTPS When set to true Create React App will run the development server in https mode PUBLIC URL Create React App assumes your application is hosted at the serving web server s root or a subpath as specified in package json homepage Normally Create React App ignores the hostname You may use this variable to force assets to be referenced verbatim to the url you provide hostname included This may be particularly useful when using a CDN to host your application CI When set to true Create React App treats warnings as failures in the build It also makes the test runner non watching Most CIs set this flag by default REACT EDITOR When an app crashes in development you will see an error overlay with clickable stack trace When you click on it Create React App will try to determine the editor you are using based on currently running processes and open the relevant source file You can send a pull request to detect your editor of choice Setting this environment variable overrides the automatic detection If you do it make sure your systems PATH environment variable points to your editor s bin folder You can also set it to none to disable it completely CHOKIDAR USEPOLLING When set to true the watcher runs in polling mode as necessary inside a VM Use this option if npm start isn t detecting changes GENERATE SOURCEMAP When set to false source maps are not generated for a production build This solves OOM issues on some smaller machines NODE PATH Same as NODE PATH in Node js but only relative folders are allowed Can be handy for emulating a monorepo setup by setting NODE PATH src Troubleshootingnpm start doesn t detect changesWhen you save a file while npm start is running the browser should refresh with the updated code If this doesn t happen try one of the following workarounds If your project is in a Dropbox folder try moving it out If the watcher doesn t see a file called index js and you re referencing it by the folder name you need to restart the watcher due to a Webpack bug Some editors like Vim and IntelliJ have a “safe write feature that currently breaks the watcher You will need to disable it Follow the instructions in “Adjusting Your Text Editor If your project path contains parentheses try moving the project to a path without them This is caused by a Webpack watcher bug On Linux and macOS you might need to tweak system settings to allow more watchers If the project runs inside a virtual machine such as a Vagrant provisioned VirtualBox create an env file in your project directory if it doesn t exist and add CHOKIDAR USEPOLLING true to it This ensures that the next time you run npm start the watcher uses the polling mode as necessary inside a VM If none of these solutions help please leave a comment in this thread npm test hangs on macOS SierraIf you run npm test and the console gets stuck after printing react scripts test env jsdom to the console there might be a problem with your Watchman installation as described in facebookincubator create react app We recommend deleting node modules in your project and running npm install or yarn if you use it first If it doesn t help you can try one of the numerous workarounds mentioned in these issues facebook jest facebook watchman ember cli ember cli It is reported that installing Watchman or newer fixes the issue If you use Homebrew you can run these commands to update it watchman shutdown serverbrew updatebrew reinstall watchmanYou can find other installation methods on the Watchman documentation page If this still doesn t help try running launchctl unload F Library LaunchAgents com github facebook watchman plist There are also reports that uninstalling Watchman fixes the issue So if nothing else helps remove it from your system and try again npm run build exits too earlyIt is reported that npm run build can fail on machines with limited memory and no swap space which is common in cloud environments Even with small projects this command can increase RAM usage in your system by hundreds of megabytes so if you have less than GB of available memory your build is likely to fail with the following message The build failed because the process exited too early This probably means the system ran out of memory or someone called kill on the process If you are completely sure that you didn t terminate the process consider adding some swap space to the machine you re building on or build the project locally npm run build fails on HerokuThis may be a problem with case sensitive filenames Please refer to this section Moment js locales are missingIf you use a Moment js you might notice that only the English locale is available by default This is because the locale files are large and you probably only need a subset of all the locales provided by Moment js To add a specific Moment js locale to your bundle you need to import it explicitly For example import moment from moment import moment locale fr If import multiple locales this way you can later switch between them by calling moment locale with the locale name import moment from moment import moment locale fr import moment locale es moment locale fr This will only work for locales that have been explicitly imported before npm run build fails to minifySome third party packages don t compile their code to ES before publishing to npm This often causes problems in the ecosystem because neither browsers except for most modern versions nor some tools currently support all ES features We recommend to publish code on npm as ES at least for a few more years To resolve this Open an issue on the dependency s issue tracker and ask that the package be published pre compiled Note Create React App can consume both CommonJS and ES modules For Node js compatibility it is recommended that the main entry point is CommonJS However they can optionally provide an ES module entry point with the module field in package json Note that even if a library provides an ES Modules version it should still precompile other ES features to ES if it intends to support older browsers Fork the package and publish a corrected version yourself If the dependency is small enough copy it to your src folder and treat it as application code In the future we might start automatically compiling incompatible third party modules but it is not currently supported This approach would also slow down the production builds Alternatives to EjectingEjecting lets you customize anything but from that point on you have to maintain the configuration and scripts yourself This can be daunting if you have many similar projects In such cases instead of ejecting we recommend to fork react scripts and any other packages you need This article dives into how to do it in depth You can find more discussion in this issue Something Missing If you have ideas for more “How To recipes that should be on this page let us know or contribute some |
2022-03-29 17:31:33 |
海外TECH |
DEV Community |
The 4 Short Frontend tips for March |
https://dev.to/melnik909/the-4-short-frontend-tips-for-march-27cd
|
The Short Frontend tips for March The Esc key is a very useful pattern Folks I have pain I m a user who tries to use a keyboard most as it s possible I don t like additional actions In this post I d like to tell about the pattern of using the Esc key when we design web interfaces Unfortunately when I use web interfaces I meet that I can t use the Esc key for canceling my action For example I showed the Pinterest solution when users login After when users push the log in button they see a modal with the login form But if we push the Esc key it doesn t close So users push have to use a mouse for closing the form That s sad I made research and came across a Booking solution When users select an interface s language they can push the Esc key and the modal will close So users don t have to do additional actions with a mouse Just one push and the action is canceled Don t make users switch caps letters to lowercaseFolks have you noticed that when you fill in an email you have to switch caps letters to lowercase The typical example is the login form on iHerb If we push on the email input field we see a keyboard with caps letter And we have to switch it to lowercase for starting filling in But most emails start in lowercase letters So showing a keyboard with lowercase letters is more user friendly because that doesn t make users do additional actions And what s awesome is that might be done just adding autocapitalize off to an input element And a browser will display a keyboard with lowercase letters And it s all Just a simple trick A digital keyboard make code entering easierFolks there is a practice to show a keyboard for entering a telephone number always when users need to enter digital type data For example that is when users log in Telegram on the website When users enter code they might be confused because they don t expect these symbols such as etc So they might make mistakes I solve this problem using the inputmode attribute The numeric value allows showing a keyboard with the digits without special symbols for entering a telephone number I hope that helps users avoid mistakes The button is the important path of the Show Hide password patternFolks I really love the Show Hide password pattern Unfortunately I see incorrect implementation sometimes where the button element is missed So users can t show or hide a password using a keyboard They have to use a mouse or other pointing device You can check out it on Booking when you log in Also I found the better approach on Airbnb On this website users can use the keyboard to quickly focus from the field to the button using the tab key Then they push the enter key for showing or hiding the password The one more thing is when the button is used screen readers can detect it for interacting So the button is the important path of the Show Hide password pattern that improves accessibility and user experience P S Thank you so much my sponsors Ben Rinehart Sergio Kagiema Jesse Willard Tanya Ten Konstantinos Kapenekakis Spiridon Konofaos Get more free tips directly to your inbox |
2022-03-29 17:02:11 |
Apple |
AppleInsider - Frontpage News |
Compared: New 2022 iPhone SE vs iPhone 13 mini |
https://appleinsider.com/inside/iphone-se/vs/compared-new-2022-iphone-se-vs-iphone-13-mini?utm_medium=rss
|
Compared New iPhone SE vs iPhone miniThe new iPhone SE may look familiar but it has quite a few new updated internals Here s how it stacks up against the next iPhone in the lineup the iPhone mini The iPhone SE Here s how the iPhone SE from compares to Apple s smaller iPhone mini across a variety of categories including processing power cameras displays and more Read more |
2022-03-29 17:53:28 |
Apple |
AppleInsider - Frontpage News |
Hackers using cop emails to steal user data from Apple, Google & others |
https://appleinsider.com/articles/22/03/29/hackers-using-cop-emails-to-steal-user-data-from-apple-google-others?utm_medium=rss
|
Hackers using cop emails to steal user data from Apple Google amp othersCriminal hackers are reportedly using an effective and sneaky technique with purloined law enforcement emails to steal user data from big tech ISPs carriers and social media companies Credit KrebsOnSecurityMore specifically attackers are apparently masquerading as law enforcement officials to obtain subpoena privileged data according to cybersecurity journalist Brian Krebs Generally they re using compromised law enforcement email accounts Read more |
2022-03-29 17:31:43 |
Apple |
AppleInsider - Frontpage News |
World Backup Day deals: save up to $440 on portable SSDs, internal and external drives, memory cards at B&H Photo |
https://appleinsider.com/articles/22/03/29/world-backup-day-deals-save-up-to-440-on-portable-ssds-internal-and-external-drives-memory-cards-at-bh-photo?utm_medium=rss
|
World Backup Day deals save up to on portable SSDs internal and external drives memory cards at B amp H PhotoMarch is World Backup Day and B amp H Photo is getting into the spirit of the holiday early with deals on external and internal drives memory cards and everything in between Choose from bargains on brands like Samsung SanDisk Seagate and LaCie to make sure you re well equipped in terms of keeping your important files safe and sound World Backup Day is March and deals on storage are plentifulWorld Backup Day deals Read more |
2022-03-29 17:16:25 |
海外TECH |
Engadget |
Apple TV+ Friday Night Baseball doubleheaders start April 8th |
https://www.engadget.com/apple-mlb-friday-night-baseball-schedule-171912642.html?src=rss
|
Apple TV Friday Night Baseball doubleheaders start April thApple s first Friday Night Baseball doubleheader will stream on April th Announced at its recent “Peek Performance event the program will see Apple stream two exclusive MLB games every Friday through the end of the regular season The first doubleheader will feature the New York Mets taking on the Washington Nationals in DC at PM ET with a match between the Houston Astros and Los Angeles Angels to follow at PM ET You can see the full schedule on Apple s website The company will share the second half of the slate at a later date The games will be available to watch for free for the time being All you need is an internet connection and access to the Apple TV app An Apple device isn t necessary You can download the software on smart TVs from manufacturers like Samsung LG and Vizio as well as consoles from Sony and Microsoft You also don t have to worry about local blackouts All games Apple announced today will be available to TV users in the eight countries and territories where the company has secured the rights for Friday Night Baseball Here s the complete list the US Canada Australia Brazil Japan Mexico Puerto Rico South Korea and the UK |
2022-03-29 17:19:12 |
Cisco |
Cisco Blog |
Continuous Learning at Cisco Leads to Career Advancement, Best-in-Class Networking Solutions |
https://blogs.cisco.com/networking/continuous-learning-at-cisco-leads-to-career-advancement-best-in-class-networking-solutions
|
Continuous Learning at Cisco Leads to Career Advancement Best in Class Networking SolutionsContinuous Learning across solutions and full stack architectures is key to developing secure innovative network technologies and keeping Cisco engineers growing in their careers |
2022-03-29 17:27:35 |
金融 |
金融庁ホームページ |
金融庁職員の新型コロナウイルス感染について公表しました。 |
https://www.fsa.go.jp/news/r3/sonota/20220329.html
|
新型コロナウイルス |
2022-03-29 18:00:00 |
金融 |
ニュース - 保険市場TIMES |
保険市場に「アフラックの休職保険」が掲載開始 |
https://www.hokende.com/news/blog/entry/2022/03/30/030000
|
保険市場に「アフラックの休職保険」が掲載開始月日より掲載株式会社アドバンスクリエイトは年月日、国内最大級の保険選びサイト「保険市場」に、アフラック生命保険株式会社の「アフラックの休職保険」を掲載したと発表した。 |
2022-03-30 03:00:00 |
ニュース |
BBC News - Home |
Shrewsbury and Telford Trust: Better care might have saved 201 babies |
https://www.bbc.co.uk/news/uk-60919474?at_medium=RSS&at_campaign=KARANGA
|
telford |
2022-03-29 17:14:15 |
ニュース |
BBC News - Home |
Ukraine war: Dozens of Russian diplomats expelled by four EU nations |
https://www.bbc.co.uk/news/world-europe-60920588?at_medium=RSS&at_campaign=KARANGA
|
czech |
2022-03-29 17:27:12 |
ニュース |
BBC News - Home |
Boris Becker trial hears star lost Wimbledon trophies |
https://www.bbc.co.uk/news/uk-60918913?at_medium=RSS&at_campaign=KARANGA
|
champion |
2022-03-29 17:27:15 |
ニュース |
BBC News - Home |
In pictures: Queen joins royals for Prince Philip's memorial service |
https://www.bbc.co.uk/news/in-pictures-60916160?at_medium=RSS&at_campaign=KARANGA
|
edinburgh |
2022-03-29 17:04:13 |
ニュース |
BBC News - Home |
Miami Open: Cameron Norrie loses to Casper Ruud |
https://www.bbc.co.uk/sport/tennis/60920528?at_medium=RSS&at_campaign=KARANGA
|
casper |
2022-03-29 17:40:21 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
朝食を食べる人と食べない人。 ダイエットに成功するのはどっち? - やせたい人はカロリー制限をやめなさい |
https://diamond.jp/articles/-/298779
|
結果 |
2022-03-30 02:50:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
自信を持とうなんてしなくていい - 「自分」の生き方――運命を変える東洋哲理の教え |
https://diamond.jp/articles/-/300130
|
|
2022-03-30 02:45:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
ひろゆきが呆れる「読書量をアピールする頭の悪い人」の特徴とは? - 1%の努力 |
https://diamond.jp/articles/-/299695
|
youtube |
2022-03-30 02:43:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
国内ETF市場の牽引役と期待される、フィンテックとは? - ETFはこの7本を買いなさい |
https://diamond.jp/articles/-/297057
|
|
2022-03-30 02:41:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
自己肯定感が低くて悩んでいる「優等生」ほど、成果を出せる理由 - 起業家の思考法 |
https://diamond.jp/articles/-/299459
|
|
2022-03-30 02:39:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
「AIが太刀打ちできない分野」に投資する方法【東大生が投資のプロに学ぶお金の教養】 - 東大金融研究会のお金超講義 |
https://diamond.jp/articles/-/299756
|
|
2022-03-30 02:37:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
株で稼ぐ人は知っている「株の正しい買い時・売り時」 - 株トレ |
https://diamond.jp/articles/-/300122
|
運用 |
2022-03-30 02:35:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
「インフルエンサー」を目指して勘違いした人気者の悲惨な末路 - 真の「安定」を手に入れるシン・サラリーマン |
https://diamond.jp/articles/-/298752
|
「インフルエンサー」を目指して勘違いした人気者の悲惨な末路真の「安定」を手に入れるシン・サラリーマン異例の発売前重版刷仕事がデキない、忙しすぎる、上司のパワハラ、転職したい、夢がない、貯金がない、老後が不安…サラリーマンの悩み、この一冊ですべて解決これからのリーマンに必要なもの、結論、出世より「つの武器」リーマン力副業力マネー力。 |
2022-03-30 02:33:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
なんで全員にリーダーシップを求めるの?(「Chikirinの日記」より) - 自分の意見で生きていこう |
https://diamond.jp/articles/-/300110
|
chikirin |
2022-03-30 02:31:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
実は気をつけるべき「投資をしないリスク」 - 世界一面白くてお金になる経済講座 |
https://diamond.jp/articles/-/299949
|
実は気をつけるべき「投資をしないリスク」世界一面白くてお金になる経済講座コロナ禍の時代が長く続き、世の中では「投資ブーム」が起こっているそうです。 |
2022-03-30 02:29:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
ジャパネットたかた創業者・高田明氏が語る「右脳と左脳の化学反応」とは - 『ザ・ゴール』20周年記念連載! |
https://diamond.jp/articles/-/300138
|
ジャパネットたかた創業者・高田明氏が語る「右脳と左脳の化学反応」とは『ザ・ゴール』周年記念連載ジャパネットたかたの佐世保本社内にあるテレビスタジオを会場に、あの聞き覚えのあるメロディにのせてスタートしたジャパネットたかた創業者現AandLive代表取締役・高田明氏のトークイベント「『ザ・ゴール』から学んだこと」。 |
2022-03-30 02:27:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
【『学習する組織』の権威が語る】システム思考の力は、子どもの自己効力感を伸ばす - 21世紀の教育 |
https://diamond.jp/articles/-/300378
|
自己効力感 |
2022-03-30 02:25:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
【サラリーマン副業】絶対にやってはいけない副業3選 - 40代からは「稼ぎ口」を2つにしなさい |
https://diamond.jp/articles/-/300448
|
新刊『代からは「稼ぎ口」をつにしなさい年収アップと自由が手に入る働き方』では、余すことなく珠玉のメソッドを公開しています。 |
2022-03-30 02:23:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
アメリカの中学生が学んでいる「遺伝子」の授業【全世界700万人が感動!】 - アメリカの中学生が学んでいる14歳からの科学 |
https://diamond.jp/articles/-/300442
|
振る舞い |
2022-03-30 02:21:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
プレゼンで「一発OK」を連発する人と、 「却下」「やり直し」が多い人の“根本的な違い” - 完全版 社内プレゼンの資料作成術 |
https://diamond.jp/articles/-/300270
|
|
2022-03-30 02:19:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
宅建と行政書士、難しいのはどっち?「4つの違い」をとことん解説! - 大量に覚えて絶対忘れない「紙1枚」勉強法 |
https://diamond.jp/articles/-/300471
|
行政書士 |
2022-03-30 02:17:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
【9割の人が知らない! 第一人者のコピー技術100】 こんな時代に、なぜメールが有効なの? - コピーライティング技術大全 |
https://diamond.jp/articles/-/298514
|
【割の人が知らない第一人者のコピー技術】こんな時代に、なぜメールが有効なのコピーライティング技術大全「最強コスパ本知ってるのと知らないのでも大きな差になる内容ばかり絶対に読んでください」と話題沸騰発売即大重版Amazonランキング第位広告・宣伝。 |
2022-03-30 02:15:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
コロナワクチン追加接種2回目、米が50歳以上向け承認 - WSJ発 |
https://diamond.jp/articles/-/300519
|
追加 |
2022-03-30 02:13:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
【精神科医が教える】 時代の流れを見事にキャッチする人の特徴 - 精神科医Tomyが教える 心の荷物の手放し方 |
https://diamond.jp/articles/-/300260
|
voicy |
2022-03-30 02:13:00 |
北海道 |
北海道新聞 |
ラベンダー編成、花咲線を試走 JR北海道、特急の利用可能性調査 |
https://www.hokkaido-np.co.jp/article/662764/
|
利用可能性 |
2022-03-30 02:25:50 |
北海道 |
北海道新聞 |
小林陵が帰国「いいシーズンになった」 ジャンプ男子、3季ぶり個人総合V |
https://www.hokkaido-np.co.jp/article/662867/
|
個人総合 |
2022-03-30 02:24:27 |
AWS |
AWS Compute Blog |
Using AWS Step Functions and Amazon DynamoDB for business rules orchestration |
https://aws.amazon.com/blogs/compute/using-aws-step-functions-and-amazon-dynamodb-for-business-rules-orchestration/
|
Using AWS Step Functions and Amazon DynamoDB for business rules orchestrationIn this post you learned how to leverage an orchestration framework using Step Functions Lambda DynamoDB and API Gateway to build an API backed by an open source Drools rules engine running on a container Try this solution for your cloud native business rules orchestration use case |
2022-03-29 18:18:39 |
Ruby |
Rubyタグが付けられた新着投稿 - Qiita |
【Ruby】条件演算子を使って指定日時になると画像が切り替わるようにする |
https://qiita.com/kani_invader/items/ea78b77c72f99b5e5d86
|
newphotoメソッドの後ろにがついてる意味ですが、このはメソッドの一部で、慣用的に、真偽値を返すタイプのメソッドを示すために使われるそうです。 |
2022-03-30 03:04:29 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
【Rails】RSpecのテストコードの書き方 |
https://qiita.com/P-man_Brown/items/ee85b11f4cba12a38fd4
|
RSpecのテストコードの構成RSpecのテストコードは以下のように記述します。 |
2022-03-30 03:57:49 |
Ruby |
Railsタグが付けられた新着投稿 - Qiita |
【Ruby】条件演算子を使って指定日時になると画像が切り替わるようにする |
https://qiita.com/kani_invader/items/ea78b77c72f99b5e5d86
|
newphotoメソッドの後ろにがついてる意味ですが、このはメソッドの一部で、慣用的に、真偽値を返すタイプのメソッドを示すために使われるそうです。 |
2022-03-30 03:04:29 |
海外TECH |
Ars Technica |
Bitcoin’s massive energy use faces $5M shame campaign from environmental groups |
https://arstechnica.com/?p=1844176
|
emulate |
2022-03-29 18:07:18 |
海外TECH |
MakeUseOf |
How to Install and Configure Pop!_OS on a PC |
https://www.makeuseof.com/how-to-install-pop-os-linux/
|
configure |
2022-03-29 18:45:16 |
海外TECH |
MakeUseOf |
7 Calming Nature-Based YouTube Channels for Meditation and Relaxation |
https://www.makeuseof.com/calming-nature-youtube-channels-meditation-relaxation/
|
Calming Nature Based YouTube Channels for Meditation and RelaxationNext time you need a break or calming sounds for meditation transport yourself to the serene scenes of these relaxing YouTube channels set in nature |
2022-03-29 18:30:14 |
海外TECH |
MakeUseOf |
Why Did the EU Reject a Bitcoin Mining Ban, and What Does It Mean for Crypto? |
https://www.makeuseof.com/why-did-the-eu-reject-bitcoin-mining-ban/
|
Why Did the EU Reject a Bitcoin Mining Ban and What Does It Mean for Crypto With Proof of Work mining in its sights the European Union voted against banning the process But what does this mean for other crypto mining |
2022-03-29 18:16:14 |
海外TECH |
DEV Community |
Remove double imports with regular expression |
https://dev.to/bwca/remove-double-imports-with-regular-expression-47af
|
Remove double imports with regular expressionOne thing I learned about imports is that they can become really messy when dealing with git conflicts The more imports there is the more time is required to sort them out Imagine merging a branch and ending with something like import Baz from baz import Foo from foo import BOHICA FUBAR FUBU SNAFU SUSFU TARFU from slang import Baz from baz import BOHICA FUBAR FUBU SNAFU SUSFU TARFU from slang import Baz from baz That s over lines nothing critical but once you need to split screen scroll to remove duplicates it s no fun Need some superpowers to remove duplicates You just need to use ancient elven magic regular expression and an IDE with replace function that supports it Check out this spell import n n Paste it into search field enable regex and run replace whoosh All import duplicates are gone you might have some extra blank lines but a prettier will fix that with a single hotkey comman import Foo from foo import BOHICA FUBAR FUBU SNAFU SUSFU TARFU from slang import Baz from baz Pretty neat eh |
2022-03-29 18:41:04 |
海外TECH |
DEV Community |
C++ maxsus belgilari |
https://dev.to/sardorpm/c-maxsus-belgilari-580m
|
C maxsus belgilari n Backslash nUshbu belgi string ichiga yoziladi Bu belgi bor joydan yangi qatorga yoziladi Masalan ️ cout lt lt Salom n dunyo lt lt endl Salom dunyo t Backslash tabBu ham string ichida yoziladi va bu bo lgan joy tab tugmasi bosilgada chiqadigan masofada joy bo sh qoldirib ketiladi ️cout lt lt olma tbehi tanor olma behi anor b Backslash bcout lt lt olma b bexi lt lt endl olm bexiBu b oldingi dona belgini o chirib yuboradi |
2022-03-29 18:37:35 |
海外TECH |
DEV Community |
AWS Infrastrucutre Maintenance Using AWS Lambda and AWS EventBridge [EC2 instance daily ebs volume snapshots] [Part 1] |
https://dev.to/soumyajyotibiswas/aws-infrastrucutre-maintenance-using-aws-lambda-and-aws-eventbridge-ec2-instance-daily-ebs-volume-snapshots-part-1-1b9p
|
AWS Infrastrucutre Maintenance Using AWS Lambda and AWS EventBridge EC instance daily ebs volume snapshots Part ContentsSummaryArchitecture diagram and high level overview of all the solutionsArchitecture diagramEC instance daily ebs volume snapshotsEC instance daily ebs snapshot cleanup after X daysEC instance daily unattached ebs volume cleanup after X daysDeregister old EC Amazon machine images after X daysAWS IAM permissionsPermissionsTrust relationshipAWS EventBridge and LambdaEC instance daily ebs volume snapshots solutionComing up next SummaryWelcome to PART of a four part tutorial on how to leverage AWS services like Lambda and EventBridge to perform housekeeping on your AWS infrastructure on a schedule automatically I am going to perform the following using AWS Lambda EventBridge and python PART Create EBS volume snapshots of all our AWS EC instances in all regions and tag them PART Cleanup EBS volume snapshots from all our regions whose age is greater than X days PART Cleanup EBS volumes from all our regions which is not attached to a resource and whose age is greater than X days PART Deregister Amazon Machine Images from all our regions whose age is greater than X days I am going to do all those using AWS EventBridge AWS Lambda and python This is going to automate any manual effort of going to every region and finding artifacts related to these and performing maintenance on them Architecture diagram and high level overview of all the solutions Architecture diagram EC instance daily ebs volume snapshotsI am going to list out all instances in all of our regions and its associated volumes and create EBS snapshots from them Also I am going to add custom tags to these snapshots EC instance daily ebs snapshot cleanup after X daysI am going to list all the EBS snapshots that we own in our regions and then delete those older than X days EC instance daily unattached ebs volume cleanup after X daysI am going to list all the EBS volumes that we own in our regions and then delete those which are not attached to any resource and older than X days Deregister old EC Amazon machine images after X daysI am going to list all the Amazon Machine Images that we own in our regions and then delete those which are not attached to any resource and older than X days AWS IAM permissionsCreate an IAM role with the following permissions and trust policy PermissionsAttach a permission policy template to your role which will allow for AWS cloudwatch log stream creation and writing Describe EC instances volumes snapshots and AMI s EC snapshot creation and deletion EC volume deletion EC AMI deregistration Version Statement Effect Allow Action logs CreateLogStream logs CreateLogGroup logs PutLogEvents Resource arn aws logs Effect Allow Action ec CreateSnapshot ec CreateTags ec DeleteSnapshot ec Describe ec ModifySnapshotAttribute ec ResetSnapshotAttribute ec DeleteVolume ec DeregisterImage Resource Trust relationshipAllow the lambda service access to your IAM role Version Statement Effect Allow Principal Service lambda amazonaws com Action sts AssumeRole AWS EventBridge and LambdaI am going to use AWS Lambda to run our python code to do run our infrastructure maintenance I am going to use AWS EventBridge to run our code via lambda on a schedule I am going to define our schedule using a cron expression to trigger daily at midnight local to our timezone You can create an EventBridge rule by going to AWS EventBridge service ️rules ️create rule The cron expression we will use will be cron I am based in India and this translate to midnight IST timezone which is GMT I am going to use AWS Cloudwatch logs to log the data from our lambda runs EC instance daily ebs volume snapshots solution Workflow and codeThe workflow that I will use is gt Midnight ️AWS EventBridge rule triggers ️Runs Lambda code ️Creates EC volume snapshots for all instances in each region ️Logs to cloudwatch logsInstall botopython m pip install botoLambda codeInitializaing a boto clientec client boto client ec Fetching all regionsdef get regions ec client return region RegionName for region in ec client describe regions Regions Initializing a boto ec resource per regionec resource boto resource ec region name region List all instances in the region using instances all You can use filters also if you want instances ec resource instances all List all volumes of each instance using volumes all You can use filters also if you want for instance in instances volumes instance volumes all Create snapshot of the volume using the create snapshot method Will create a tag of Instance Id and assign it the value of the instance id the volume is attached to and also a tag of Device and assign it the value of the attribute Device from the volume desc f Backup for instance i id and volume v id tags Key Instance Id Value f instance id Key Device Value f volume attachments Device for volume in volumes snapshot volume create snapshot Description desc TagSpecifications ResourceType snapshot Tags tags Putting it all together Take a look at my GITHUB page for the complete code Cloudwatch logs Coming up nextPart of this tutorial where I will talk about creating code for daily ebs snapshot cleanup older than X days |
2022-03-29 18:36:43 |
海外TECH |
DEV Community |
#Day 10 of solving 450 questions [32/450] |
https://dev.to/hesoyamm/day-10-of-solving-450-questions-32450-2l7b
|
Day of solving questions Question solved TRAPPING RAIN WATER minimum operations to reduce x to zero |
2022-03-29 18:36:27 |
海外TECH |
DEV Community |
How to connect Apache tomcat to Apache Netbeans IDE |
https://dev.to/vishal8236/how-to-connect-apache-tomcat-to-apache-netbeans-ide-65g
|
How to connect Apache tomcat to Apache Netbeans IDE What is Apache tomcatit s an open source Java servlet and Java Server Page container that lets developers implement an array of enterprise Java applications Tomcat also runs a HTTP web server environment in which Java code can run What is Apache NetbeansIt s a IDE that is use to develop any kind of application like Java EE application PHP Java SE application and many more It provide many tools and plugin that will productive developers works Before move further download apache tomcat and netbeansDownload apache tomcat version Download Apache Netbeans version you can download any version right now for the tomcat version is available but for this blog we will use tomcat version and Netbeans version you can also download Netbeans version Download Apache tomcat file and unzip it Open the Netbeans IDEClick on Services tabNow right click on Servers and add serverClick on Browse button and Select tomcat folder that you downloadedNow config username and password and should be remember because when you will run the server it will ask you to enter username and password Now your server will create on server tab and select server and do right click on created server and start server It will ask you to enter username and password To check your server run successfully or not run below link on browser http localhost |
2022-03-29 18:30:21 |
海外TECH |
DEV Community |
Writing code on doors |
https://dev.to/sshine/writing-code-on-doors-257e
|
Writing code on doorsDid you ever see pseudo code in job ads that looked likeif you like to work here True job apply and thought to yourself a bunch of things about variables not being in scope and whether their actual code has utterly specific library functions Did you ever try to design an authentic piece of pseudo code and found how difficult it is to remain concise enough to get the point across but also idiomatic enough to even care expressing this as code At my local office a sign was recently posted with instructions to lock the office Shortly after another sign followed AnalysisHaving policies listed on the door is a bit messy but it gets the point across Perhaps some of the mess can be reduced by analysing the process through which they ended up here and produce a shorter version Growing an office policy is an iterative process and two separate methods of adding new rules were used Adding to the paper with the existing policy and hanging up new paper The fact that a new rule is added with a pen is not actually a problem but is the greatest feature of paper tech that we have yet to reinvent elsewhere Both methods introduce redundancy The hand written Turn off coffee machine and all but one of the printed bullets are listed twice Since the lists are short it is easy to determine what the key point is Start the dishwasher before weekends begin Being new to Rust I wanted to write the stupid pseudo code version of this My first iteration simply tried to reduce code duplication by making the weekend dishwasher rule conditional impl Shutdown for Office fn leave amp mut self now DateTime lt Local gt self lights Off self lock On self coffee machine stop if now weekday Weekday Fri self dishwasher start The basic thing I like about this code is that it looks like Rust but doesn t go much into what a Shutdown or an Office actually is AmbiguityThe lovely and sometimes frustrating thing about human language is that it leaves room for ambiguity You can say multiple things at once say different things to different people with one message and leave room for interpretation The moment you write human instructions as programming code the ambiguity becomes glaringly apparent Once I had read the instructions as programming code I immediately thought Wait what if Friday is a bank holiday I actually want a softer definition of weekend Abusing ambiguitySo wait I m starting the dishwasher on Fridays no matter what just because it s weekend This seems like an X Y problem I know how dishwashers work We don t want to accumulate smell over the weekend and we like to tidy our workspace so that arriving to it gives you energy But we also don t want to pointlessly start dishwashers on Fridays What are the actual criteria impl Shutdown for Office fn leave amp mut self now DateTime lt Local gt self lights Off self lock On self coffee machine stop if now is beginning of weekend amp amp self dishwasher is full self dishwasher start So wait We only start the dishwasher on Fridays if it s full What if it s half full or it s full and isn t a Friday What if the dishwasher has already started Do we assume that start is idempotent do we stop the machine just to start it again or do we busy wait for the machine to stop just to start it a second time It is Friday after all A problem of joining the two pieces of paper was that they carried different implicit assumptions joining them the absence of any non Friday dishwasher logic should not imply a hard rule against using the dishwasher on non Fridays We could be more explicit about overlapping event handlers but that sounds like boilerplate code Brevity and implicitnessClearly a dishwasher has multiple states It can be empty or non empty and a special case of non empty is full It can be running or not running and a special case of not running is that the last thing that happened was that it completed a run This does not speak of the content of the dishwasher Enter brevity Okay sure human language is advantageously ambiguous as in common sense is implied But what we can do instead is use high level expressions that capture a particular state In the following is complete means both not running and that it probably shouldn t be started So the following iterationimpl Shutdown for Office fn leave amp mut self now DateTime lt Local gt self lights Off self lock On self coffee machine stop The dishwasher is either running or hasn t started if self dishwasher is complete self dishwasher start It was at this time that I changed the policy and let go of the Dishwasher Friday rule I know I know cleaning nazi But really as these rules are explicated further I am sure that people will appreciate how rarely they actually have to start the dishwasher once they wield the powers of formal logic You start empty dishwashers There are two nitpicks left until I m happy Let s not start empty dishwashers just because we can And let s add soap A lady came by and suggested that we also want to turn off the AC when we leave Since we re programming and Rust has sequential evaluation semantics let s not turn off the lights and lock the door before we ve performed the tasks that are better performed with unimpaired vision and being able to leave impl Shutdown for Office fn leave amp mut self self air condition Off self coffee machine stop The dishwasher is either running or hasn t started if self dish washer is complete if self dish washer is empty self dish washer add soap self dish washer start self lights Off self lock On |
2022-03-29 18:18:06 |
海外TECH |
DEV Community |
Top 7 Featured DEV Posts from the Past Week |
https://dev.to/devteam/top-7-featured-dev-posts-from-the-past-week-3bd2
|
Top Featured DEV Posts from the Past WeekEvery Tuesday we round up the previous week s top posts based on traffic engagement and a hint of editorial curation The typical week starts on Monday and ends on Sunday but don t worry we take into account posts that are published later in the week Your tools can be wrong sometimesWe all want our sites to be fast and it takes a lot of small wins in order to add up to this outcome mlrawlings points out two performance factors that are often overlooked and how your devtools may mislead you into believing them unimportant Your SSR is slow amp your devtools are lying to you Michael Rawlings・Mar ・ min read javascript performance Must read books for developersChoosing a career in tech is choosing an endless life of learning One person doesn t have time to read all of the books out there so tmchuynh put together a shortlist of her favorite books for developers Books to Read as a Developer Tina Huynh・Mar ・ min read discuss books todayisearched beginners Pushing DEV posts to GitHub Pages brunodrugowick wanted a simple static site with the list of posts from their DEV profile Check out how he made it work using GitHub Pages Automatically update your GitHub Pages website with posts from dev to Bruno Drugowick・Mar ・ min read github githubactions jekyll static Presto When you have a lot of side projects it can be tough to manage all the issues that are sent to your email inbox But now every time a new issue is made aschmelyun gets a physical ticket printed out on his desk I built a receipt printer for GitHub issues Andrew Schmelyun・Mar ・ min read php iot showdev For when you re aiming beyond good enough Thank you trishathecookie for this helpful and indeed actionable guide to leveling up your impact as a frontend dev Good stuff Actionable Steps to Becoming a Better Frontend Developer Trisha Lim・Mar ・ min read frontend webdev design beginners Your inbox may not be as private as you thinkWhen it comes to privacy and the law the end ultimately justifies all means and companies may change their conditions at any time jmau speaks on the ways in which email privacy has been breached Your inbox is not a digital safe Julien Maury・Mar ・ min read security privacy mail Farewell Nick ️ nickytonline is moving on to the next chapter and all of us here at Forem will miss him dearly ーthe good news Nick will continue to spread his positivity and skills across the tech landscape and his impact will be felt here at Forem for a long time to come Thank you for everything Nick My Impact at Forem Nick Taylor・Mar ・ min read career That s it for our weekly Top for this Tuesday Keep an eye on dev to this week for daily content and discussions and be sure to keep an eye on this series in the future You might just be in it |
2022-03-29 18:14:24 |
海外TECH |
DEV Community |
React Native Conditional Rendering |
https://dev.to/vladimirvovk/react-native-conditional-rendering-16eo
|
React Native Conditional RenderingIn general conditional rendering in React Native is the same as in React But be aware that in React Native we can render strings only inside the Text component So for example if we will try to put a string inside a View we will get an error Inline if with logical amp amp operator lt View gt error amp amp lt ErrorMessage gt lt View gt Double negation operator is very important here also we can use the Boolean function because it ensures that the left part of the condition will be a boolean value Why it is important Because logical “and operator amp amp will return the right side of the condition if the left side is truthy And will return the left side of the condition if the left side is falsy Imaging we have a component lt View gt error amp amp lt ErrorMessage gt lt View gt If the error variable will be an object null or undefined everything will work as expected But if we will get an empty string for the error error then our component will brake because we can t render strings inside a View component error error amp amp lt something gt will return the error variable which equals to the empty string and we will get lt View gt lt View gt which will throw an error because we can t render strings inside a View Inline if else with ternary operator error lt ErrorMessage gt lt SuccessMessage gt or error lt ErrorMessage gt null Here we can return null or lt gt lt gt React Fragment depend on our component structure and return type if statement const Error gt if error return null return lt ErrorMessage gt return lt View gt lt Error gt lt View gt Code examplePlease use this Expo Snack to see the full code and play with it press button and happy hacking CreditsPhoto by Isaac Struna on Unsplash |
2022-03-29 18:08:29 |
海外TECH |
DEV Community |
Como a Trybe corrige mais de 20 mil avaliações por semana! |
https://dev.to/trybe/como-a-trybe-corrige-mais-de-20-mil-avaliacoes-por-semana-1i6f
|
Como a Trybe corrige mais de mil avaliações por semana Para quem não conhece a Trybe éuma escola de desenvolvimento web que tem comprometimento genuíno com o sucesso profissional de quem estuda conosco Com o Modelo de Sucesso Compartilhado MSC ofertado pela Trybe Fintech a pessoa estudante tem a opção de pagar apenas quando jáestiver trabalhando vocêacredita nesse nível de confiança E para isso precisamos ter um infraestrutura para avaliar todos os projetos enviados pelas pessoas estudantes Hoje utilizamos GitHub Actions entretanto usar os executores oferecidos pelo próprio GitHub Cloud não éo suficiente pois esgotaríamos os minutos oferecidos pelo plano rapidamente Simulação de uma pessoa estudante esperando pela sua avaliaçãoLogo optamos por manter nossa própria infraestrutura de self hosted runners e melhor ainda tudo orquestrado usando Kubernetes Veja na imagem abaixo como éo esquema de funcionamento Após isso temos o passo a passo explicando o fluxo Passo A pessoa estudante envia seu projeto como um pull request no repositório Passo De acordo com a configuração do workflow o trigger éacionado e uma nova avaliação éinserida na fila de workflows do repositório Passo Os self hosted runners funcionam como pull based ou seja eles fazem pulling no GitHub API aguardando por jobs àserem executados Épossível que não haja runners disponíveis no momento Então nós temos um controller que se comunica com o GitHub API sobre a condição atual dos runners Se não houver runners disponíveis no momento o controler aciona o Horizontal Runner Autoscaler para escalar para cima o número de runners em nossa infraestrutura Ao mesmo tempo nosso controler também verifica se não temos runners demais Se mais de dos runners atuais estão em idle isso significa que podemos diminuir o número de runners para melhorarmos nossos custos com infraestrutura O controler aciona o Horizontal Runner Autoscaler para escalar para baixo o número de runners em nossa infraestrutura Passo A avaliação éfeita utilizando uma série de actions implementados pelo time da Trybe Essas actions envolvem linters de arquivos execução do cypress testes unitários etc Passo Após executar a avaliação a última action do workflow envia o resultado obtido para o nosso backend de avaliações para ser armazenado em nosso banco de dados Passo Como muitas pessoas estudantes enviam suas avaliações ao mesmo tempo foi implementado uma solução utilizando Amazon MQ para enfilieirar o processo de avaliação e também evitar um possível rate limit na API do GitHub Passo Após processar a avaliação que estava na fila de mensageria o backend de avaliação faz um comentário no PR da pessoa estudante informando o resultado Bem simples né O processo parece ser complicado mas énecessário pelo tamanho da demanda que temos em corrigir mais de mil avaliações por semana Agora veja todo o processo em apenas uma figura Processo de correçãoGostou do que viu Quer ajudar a Trybe a manter esta infraestrutura Venha pois temos várias vagas abertas |
2022-03-29 18:06:46 |
Apple |
AppleInsider - Frontpage News |
Best external hard drives and SSDs for Mac in 2022 |
https://appleinsider.com/inside/mac/best/best-external-hard-drive-for-mac?utm_medium=rss
|
Best external hard drives and SSDs for Mac in If you need more storage space on your new Mac you have plenty of different options to choose from Here are our favorite external hard drive and SSD choices for Mac from smaller zippy options to rugged hard drives that will protect your data drop after drop Best external hard drives and SSDs for Mac in There are plenty of hard drives and SSDs on the market right now with brands that focus on portability some that center on speed and others that offer the most protection they can for your files But they re not all cut from the same cloth Be sure the hard drive or SSD you decide to purchase ticks all the boxes so to speak when it comes to what you re looking for Read more |
2022-03-29 18:57:24 |
Apple |
AppleInsider - Frontpage News |
World Backup Day deals: save up to $440 on portable SSDs, internal and external drives, memory cards at B&H Photo |
https://appleinsider.com/articles/22/03/29/world-backup-day-deals-save-up-to-440-on-portable-ssds-internal-and-external-drives-memory-cards-at-bh-photo?utm_medium=rss
|
World Backup Day deals save up to on portable SSDs internal and external drives memory cards at B amp H PhotoMarch is World Backup Day and B amp H Photo is getting into the spirit of the holiday early with deals on external and internal drives memory cards and everything in between Choose from bargains on brands like Samsung SanDisk Seagate and LaCie to make sure you re well equipped in terms of keeping your important files safe and sound World Backup Day is March and deals on storage are plentifulWorld Backup Day deals Read more |
2022-03-29 18:55:38 |
海外TECH |
Engadget |
Messenger takes a cue from Slack with an @everyone shortcut |
https://www.engadget.com/messenger-shortcuts-tag-everyone-gifs-slack-185800987.html?src=rss
|
Messenger takes a cue from Slack with an everyone shortcutMeta is adding a handful of features to the Messenger app that will be familiar to anyone who s used Slack most notably with a new everyone function Starting today typing everyone in a chat in Messenger will alert the entire group to your message ーso make sure it s a good one Messenger is also adding a silent function which ensures your message will arrive in the chat without alerting anyone like a ghost in the night Just type silent before your message and you re in sneak mode Both everyone and silent commands are live on Android and iOS today Meta has more Messenger plans in the works Over the coming weeks Android and iOS Messenger users in the US will be able to use a pay shortcut to send and receive money in chat On top of that iOS users will get gif which drops searchable gifs directly into the chat Messenger on Apple devices will also get shrug and tableflip commands which populate the ¯ ツ ¯and ╯° ° ╯︵┻ー┻emoticons respectively |
2022-03-29 18:58:00 |
海外TECH |
Engadget |
Verizon says ‘bad actors’ are to blame for sketchy spoofed spam texts |
https://www.engadget.com/verizon-acknowledges-spam-campaign-184143673.html?src=rss
|
Verizon says bad actors are to blame for sketchy spoofed spam textsVerizon is aware of a spam campaign that is targeting its customers with their own phone numbers As first reported by The Verge some of the carrier s subscribers have complained in recent days of receiving text messages that offer “a little gift for paying off their monthly phone bill with a link that leads to a Russian website What has made the campaign unsettling for some is that the perpetrators are spoofing the numbers of their targets “Our team is actively working to block these messages and we have engaged with US law enforcement to identify and stop the source of this fraudulent activity a Verizon spokesperson told Engadget “Verizon continues to work on behalf of our customers to prevent spam texts and related activity When reports of the campaign first started to appear online some Verizon customers speculated it was the result of an internal breach a claim the carrier denies “We believe this activity is being generated from external bad actors with no direct tie to our company the company told The Verge Verizon also said it has no evidence that suggests the texts are coming from Russia The texts come as US officials including President Biden have warned of potential Russian cyberattacks in response to the sanctions imposed on Russia following its invasion of Ukraine Like with most spam and phishing attempts the best thing you can do to protect yourself is to not open the link that accompanies the text |
2022-03-29 18:41:43 |
海外TECH |
Engadget |
Sennheiser's headphones can now switch modes based on location |
https://www.engadget.com/sennheiser-earbuds-headphones-location-ambeo-airplay-182649020.html?src=rss
|
Sennheiser x s headphones can now switch modes based on locationSennheiser just delivered a pair of updates that could make its audio gear more compelling particularly at the end of a long work day To start an upgrade to the Smart Control app for Android and iOS can automatically change your headphones EQ noise cancellation levels and other settings based on your location This isn t a new feature in the audio world Sony has offered this for years but it ll be appreciated if you want to hear colleagues at the office but tune out the world while at home The Smart Control revamp also offers a Sound Check feature to help the EQ match your tastes and user account support helps you carry settings between device Sennheiser also promises a more intuitive not to mention sleeker looking interface The Ambeo soundbar meanwhile is becoming decidedly smarter Sennheiser is launching an quot Ambeo OS quot platform that expands the TV speaker s functionality You ll finally get AirPlay Spotify Connect and Tidal Connect support to stream your music service of choice And while you can steer the soundbar through Smart Control you ll also have a web interface if you d rather navigate from your computer This last update won t make the Ambeo s sticker easier to handle It at least provides the kind of connectivity you d expect for that money though And look at it this way Ambeo OS could make Sennheiser s more affordable soundbar that much more alluring when it arrives later this year |
2022-03-29 18:26:49 |
Cisco |
Cisco Blog |
Secure Your Seat at Automation Developer Days |
https://blogs.cisco.com/developer/automationdeveloperdays01
|
Secure Your Seat at Automation Developer DaysRegistration is now open Join us virtually or in person in Stockholm Sweden for three intensive days of technology deep dives customer stories and hands on labs Share your experience and connect with industry peers |
2022-03-29 18:20:05 |
Cisco |
Cisco Blog |
Assessing the Real-World Environmental Impact of Routers |
https://blogs.cisco.com/sp/assessing-the-real-world-environmental-impact-of-routers
|
Assessing the Real World Environmental Impact of RoutersNetworking equipment power claims are complicated Is it chip card or system power being stated and how was it evaluated To pursue more energy efficient routers and switches we need to understand what this really means |
2022-03-29 18:19:29 |
海外科学 |
NYT > Science |
Mariupol Residents Describe How Russian Forces Deprived Them of Food and Water |
https://www.nytimes.com/2022/03/29/world/europe/mariupol-ukraine-russia-war-food-water.html
|
Mariupol Residents Describe How Russian Forces Deprived Them of Food and WaterResidents of Mariupol Ukraine described how Russian forces use hunger as a weapon of war in a monthlong siege of the southern port “No roof no food and no water survivors texted relatives who escaped |
2022-03-29 18:27:34 |
海外科学 |
NYT > Science |
How to Find a Therapist or Mental Health Provider |
https://www.nytimes.com/2022/03/29/well/mind/therapist-mental-health-provider.html
|
providertips |
2022-03-29 18:11:49 |
ニュース |
BBC News - Home |
Queen attends Prince Philip memorial service at Westminster Abbey |
https://www.bbc.co.uk/news/uk-60902088?at_medium=RSS&at_campaign=KARANGA
|
westminster |
2022-03-29 18:26:59 |
ニュース |
BBC News - Home |
UK seizes first superyacht in British waters |
https://www.bbc.co.uk/news/business-60912754?at_medium=RSS&at_campaign=KARANGA
|
businessman |
2022-03-29 18:01:25 |
ニュース |
BBC News - Home |
Four killed in new attack in Israel |
https://www.bbc.co.uk/news/world-middle-east-60902330?at_medium=RSS&at_campaign=KARANGA
|
attack |
2022-03-29 18:29:55 |
ニュース |
BBC News - Home |
MPs vote to back publication of Lord Lebedev peerage security advice |
https://www.bbc.co.uk/news/uk-politics-60915336?at_medium=RSS&at_campaign=KARANGA
|
lords |
2022-03-29 18:07:04 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
地銀がDXアドバイザーになるために避けられない「痛みと覚悟」 - きんざいOnline |
https://diamond.jp/articles/-/300303
|
online |
2022-03-30 03:50:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
ソニー初代会長に転身した万代順四郎、銀行一筋時代の回顧 - The Legend Interview不朽 |
https://diamond.jp/articles/-/300306
|
thelegendinterview |
2022-03-30 03:45:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
円安進行でも問題なし、日米が黙認する理由 - WSJ PickUp |
https://diamond.jp/articles/-/300434
|
wsjpickup |
2022-03-30 03:40:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
戦争・制裁・コロナで変わるサプライチェーン - WSJ PickUp |
https://diamond.jp/articles/-/300435
|
wsjpickup |
2022-03-30 03:35:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
ロシア産ガス、岸田首相の地元にとっても大問題 - WSJ PickUp |
https://diamond.jp/articles/-/300436
|
wsjpickup |
2022-03-30 03:30:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
中国人より自己表現が下手な日本人、「PQ」を鍛える3つの条件とは - News&Analysis |
https://diamond.jp/articles/-/298530
|
newsampampanalysis |
2022-03-30 03:25:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
「Web3」を机上論にしないために不可欠な、従来ビジネスからの発想転換 - 及川卓也のプロダクト視点 |
https://diamond.jp/articles/-/300356
|
及川卓也 |
2022-03-30 03:20:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
ひろゆきが「ウクライナ情勢に、何もできない自分が歯がゆい」人へ送るアドバイス - 酒井真弓のDX最前線 |
https://diamond.jp/articles/-/300433
|
一問一答 |
2022-03-30 03:15:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
サッカー日本代表W杯出場決定!ところで選手の「報酬」ってどれくらい? - ニュース3面鏡 |
https://diamond.jp/articles/-/300382
|
日本サッカー協会 |
2022-03-30 03:10:00 |
ビジネス |
ダイヤモンド・オンライン - 新着記事 |
リモートワークにも使える!科学的に正しい働き方改革 - ニュース3面鏡 |
https://diamond.jp/articles/-/300432
|
リモートワークにも使える科学的に正しい働き方改革ニュース面鏡長引くコロナ禍で、仕事へのモチベーションや働き方が変わったという人は多いでしょう。 |
2022-03-30 03:05:00 |
Azure |
Azure の更新情報 |
NC-series Azure Virtual Machines retirement extended to 31 August 2023 |
https://azure.microsoft.com/ja-jp/updates/ncseries-azure-virtual-machines-retirement-extended-to-31-august-2023/
|
august |
2022-03-29 18:20:14 |
Azure |
Azure の更新情報 |
Update: NC-series Azure Virtual Machines will be retired by 31 August 2023 |
https://azure.microsoft.com/ja-jp/updates/ncseries-azure-virtual-machines-will-be-retired-by-31-august-2022/
|
august |
2022-03-29 18:19:45 |
コメント
コメントを投稿