react-hook-formとyupを使った重複チェックバリデーション
最近yupに値の重複チェックするためのいい感じの機能が入ったので、react-hook-formと組み合わせて重複チェックをする方法を備忘のため書き綴っていきます。
今まではデータのネストが深い場合、ネストを遡って他のデータにアクセスしデータのバリデーションが難しかったのですが、yupのv0.29.1から追加されたtest
関数のコンテキストのfrom
プロパティを使用することによってネストを遡ることが容易になりました。
jquense/yup#556
今回はそのfrom
を使用し、フォームの重複チェックバリデーションを作ってみます。
name: deploy dev from feature by pull request | |
on: | |
issue_comment: | |
types: | |
- created | |
jobs: | |
deploy: | |
# add comment of pull request && comment is KEYWORD |
更新: | 2023-08-13 |
---|---|
作者: | @voluntas |
バージョン: | 2023.1 |
URL: | https://voluntas.github.io/ |
変更履歴
###AnyDesk - How Enable Remote Access from ubuntu/debian terminal.
Here are the commands might be usefull in this purpose:
anydesk --get-status
: To get current status of anydesk, which might beofflien,online
or nothing.anydesk --get-id
: To get the ID that your system can be accessed by.anydesk --service
: To start anydesk service if not already running (for Linux).anydesk --restart-service
: To restart anydesk serviceanydesk --stop-service
: To stop anydesk service
// References used: | |
// - https://yesviz.com/devices.php | |
// - https://ricostacruz.com/til/css-media-query-breakpoints | |
// - https://tailwindcss.com/docs/responsive-design/#customizing-breakpoints | |
screens: { | |
'2xs': { min: '300px' }, | |
xs: { max: '575px' }, // Mobile (iPhone 3 - iPhone XS Max). | |
sm: { min: '576px', max: '897px' }, // Mobile (matches max: iPhone 11 Pro Max landscape @ 896px). | |
md: { min: '898px', max: '1199px' }, // Tablet (matches max: iPad Pro @ 1112px). | |
lg: { min: '1200px' }, // Desktop smallest. |
記事の執筆には、Markdown形式を利用してください。 Markdownにはさまざまな流派がありますが、GitHub Flavored Markdown(https://github.github.com/gfm/ )をベースとした書式を採用します。
書籍を執筆するための形式として考えると、Markdownには不足している機能が多々あります。 しかし、次のような利点があるので、Markdownを採用することにします。
- 最低限の構造しかないので、見た目でごまかせる余地が少ない
- 原稿を著者自身が再利用してもらいやすくしたい
postFile('http://example.com/api/v1/users', 'input[type="file"].avatar') | |
.then(data => console.log(data)) | |
function postFile(url, fileSelector) { | |
const formData = new FormData() | |
const fileField = document.querySelector(fileSelector) | |
formData.append('username', 'abc123') | |
formData.append('avatar', fileField.files[0]) |
For a while, JSX
and new es6 syntax had flaky support in emacs, but there's been huge work on a lot of packages. Using emacs for JavaScript with React, ES6, and Flow (or Typescript, etc) is really easy and powerful in Emacs these days.
This is how you can work on modern web development projects with full support for tooling like JSX, Flow types, live eslint errors, automatic prettier.js formatting, and more.
Set up web-mode
web-mode
provides most of the underlying functionality, so a huge shout-out to the maintainer(s) there.