JavaScript– tag –
-
Next.js
【Next.js】useSWR()でPOSTする
useSWR()を使ってデータを取得するには以下の方法で取得できました。 const commentsFetcher = (url: string): Promise<fetchCommentsReturnType> => axios(url).then((res) => res.data); const { data: comments, error:commentsError } = u... -
Next.js
【Next.js】axiosを使ってSWRで取得する
Next.jsのSWRでデータを取得するときにaxiosを使った方法をご紹介します。 APIサーバーはLaravelを想定しています。また、Laravelでデータを返すときはEloquentのAPI Resourcesを使用しているものとします。 https://laravel.com/docs/8.x/eloquent-resour... -
React
Controlling Material UI v4 Form with React Hook Form v7
In this article, I will show you how to control a Material UI v4 form with React Hook Form v7. Material UI's TextField, Radio, and Select work just fine, but Checkbox requires some tricks and ingenuity.Here is a sample code for your refe... -
React
Controlling Material UI v4’s Checkbox with React Hook Form v7
In Controlling Material UI's Checkbox with React Hook Form, I introduced how to control Material UI's Checkbox with React Hook Form v6. After that, React Hook Form v7 was released.The way to control Material-UI has changed a little in Re... -
Next.js
How to use Next.js and Material-UI’s Link together
Next.js links and Material-UI links cannot normally be used together.However, with a little ingenuity, they can be used together. The following are the requirements for the Link component that we will create using Next.js and Material-UI... -
Next.js
Use material-table in Next.js
Next.js and material-table are very easy to use and I use them a lot.However, they don't work well together, and material-table doesn't work straightforwardly with Next.js. There is a sticking point for using material-table in Next.js, a... -
React
React Hook Form v7でMaterial UI v4のフォームを制御する
今回はReact Hook Form v7でMaterial UI v4のフォームを制御する方法をご紹介します。 Material UIのTextFieldやRadio、Selectは素直に動いてくれますが、Checkboxはちょっとしたコツ、工夫が必要です。サンプルコードをご紹介しますので是非参考にしてく... -
React
React Hook Form v7でMaterial UI v4のCheckboxを制御
React Hook FormでMaterial UIのCheckboxを制御でReact Hook Form v6でMaterial UIのCheckboxを制御する方法を紹介しました。 その後、React Hook Form v7がリリースされた。React Hook Form v7でMaterial-UIを制御する方法が少し変わりましたので、Materi... -
React
Prohibit browser back or warn when reloading or closing tabs
When you are creating a form or something similar, there are times when you don't want the user to browser back, reload, or do anything else. The reason for this is that before the data you enter is saved, it will be lost by browser back... -
React
TypeError: _this.props.onChangePage is not a function
When I click on the pagination of material-table, I get the following error. Unhandled Runtime Error TypeError: _this.props.onChangePage is not a function The environment in which this error occurs is as follows. material-ui v4.12.2 v5 a...