Mike  Kozey

Mike Kozey


How to Disable Button Tutorial in React

React: How to disable button tutorial

Here's how you disable a button using React

When you need to disable a button using React, you can simply add the disabled prop to your <button> element:

function App() {
  return <button disabled={true}>Click me!</button>;

Knowing this, you can easily modify the code according to your requirements to disable the <button>.

React disable button after click

For example, you may want to disable a <button> after it has been clicked. You can do so by adding a state that controls the value of disabled prop. Let’s name the state disable and set its default value to false:

const [disable, setDisable] = React.useState(false);

After that, you need to use the disable state value as the value of disabled prop in the <button> element.

Finally, add an onClick prop to the <button> element that will set the disable state to true.

The full code is as shown below:

import React from "react";
function App() {
  const [disable, setDisable] = React.useState(false);

  return (
    <button disabled={disable} onClick={() => setDisable(true)}>
      Click me!

With the code above, your button will be disabled once it receives a click event.

React disable button for login form

In another example, you may have a login button that you want to disable as long as the email and password <input> is empty.

You can easily do so by checking controlling the value of both <input> elements using the state.

When the value of email or password state is empty, the disabled prop value must be true. You can do so by using the following code:

disabled={!email || !password}

The following code example shows how to do it:

import React, { useState } from "react";

function App() {
  const [email, setEmail] = useState("");
  const [password, setPassword] = useState("");

  const handleEmailChange = (event) => {

  const handlePasswordChange = (event) => {

  const handleSubmit = (event) => {
    alert(`Your state values: \n 
            email: ${email} \n 
            password: ${password} \n 
            You can replace this alert with your process`);

  return (
    <form onSubmit={handleSubmit}>
        <label>Email address</label>
          placeholder="Enter email"
          placeholder="Enter password"
      <button type="submit" disabled={!email || !password}>

This way, your <button> element will be disabled as long as the value of email or password state is falsy


To conclude, you can disable a <button> element in React by setting the disabled prop to true.

Depending on the conditions required to disable the <button>, you can manipulate the disabled prop through various ways, such as by checking if the form values are empty or the <button> has been clicked by the user.

Original article source at: https://sebhastian.com/

#react #disable #button 

How to Disable Button Tutorial in React
Jammie  Yost

Jammie Yost


Dockerfile Linter (written in Node.js)

Dockerfile Linter (written in Node.js)


A Dockerfile linter that you can use to quickly check if your Dockerfile follows the best practices for building efficient Docker images. The tool uses ShellCheck analysis tool to lint code in RUN instructions. Some of the rules were inspired by Hadolint and Dockerfile reference documentation.


The linter requires Node.js to run:

npm install --global dockerlinter



The linter can be used directly from the CLI:

dockerfilelinter -f <path to Dockerfile>
dockerfilelinter -f <path to Dockerfile> -s bash #default sh
dockerfilelinter -f <path to Dockerfile> -s none #disable shellcheck
dockerfilelinter -f <path to Dockerfile> -i ER0012,ER0015 #coma separated list of ignored rules
dockerfilelinter -f <path to Dockerfile> -e #return error code 1 for any error
dockerfilelinter -f <path to Dockerfile> -e warning #return error code 1 for errors with level 'warning' or higher(available levels: info, warning, error)


Docker allows you to run the linter on any type of platform. To mount the file, use the -v parameter:

docker build . -t imagename
docker run -v /tmp/files/dockerfile:/dockerfilelinter/dockerfile imagename linter -f dockerfile

Inline ignores

You can ignore rules for a specific instruction block in the Dockerfile by commenting it. The ignore comment must be applied above the instruction as # linter ignore=EF0003. The exceptions are ED and EL rules. Example:

# linter ignore=EF0003,EF0004
FROM node

YAML file with ignores

You can create YAML file "your dockerfile name".linter.yaml with list of ignored rules for specific Dockerfile or for all in folder dockerfilelinter.yaml. If you put file in the same folder where linting dockerfile is it will be auto-detected, but you can also use flag -y/--yaml to specify a path. Example:

 - ER0012
 - ER0015


The list of rules implemented.

  • Rules with the E prefix come from dockerfilelinter. Implementation can be found in lib/lints.js.
  • Rules with the SC prefix come from ShellCheck. You can find their description in the tool's Wiki. For a more detailed description, use the Pages search tool.


ED - Error Directives EI - Error Instructions ER - Error RUN EC - Error COPY EU - Error USER EF - Error FROM EW - Error WORKDIR EE - Error EXPORT EL - Error Lines EA - Error ADD EJ - Error JSON

EL0001Invalid line
ED0001All parser directives must be at the very top of a Dockerfile.
ED0002Directive appears more then once.
ED0003Directives should be lowercase.
ED0004Parser directive will be treated as a comment.
ED0005Missing value for directive.
ER0001Set the SHELL option -o (-eo for Alpine image) pipefail before RUN with a pipe in.
EU0001Last user should not be root.
EI0001There can only be one instruction like (CMD, HEALTHCHECK, ENTRYPOINT).
EI0002FROM may only be preceded by one or more ARG.
EF0001Missing FROM.
EC0001COPY --from cannot reference its own FROM alias.
EC0002COPY --from should reference a previously defined FROM alias.
EI0003MAINTAINER is deprecated, instead use LABEL.
EJ0001You must use double-quotes (") in JSON array.
EJ0002CMD and ENTRYPOINT should be written in JSON form.
EJ0003SHELL must be written in JSON form.
EF0002FROM aliases must be unique.
EF0003Using latest is prone to errors if the image will ever update.
EF0004Always tag the version of an image explicitly.
ER0002Delete the apt-get lists after installing something.
ER0003Use WORKDIR to switch to a directory.
ER0004Do not use sudo, consider using gosu.
ER0005Command (ssh, vim, shutdown, service, ps, free, top, kill, mount, ifconfig) does not make sense in a container.
ER0006Using (apt-get upgrade, dist-upgrade, apk upgrade, apt install) is not recommended.
EA0001Use curl or wget instead, and delete files when no longer needed.
EC0003Use ADD for extracting archives into a image.
ER0007Either use wget or curl, but not both.
ER0008Use SHELL to change the default shell.
ER0009Use the -y switch.
ER0010Avoid additional packages by specifying --no-install-recommends.
EA0002Use COPY instead of ADD for files and folders.
EC0004COPY with more then 2 arguments requires the last argument to end with /.
ER0011Use the --no-cache switch.
ER0012Pin versions in apt get install.
ER0013Pin versions in pip install.
ER0014Pin versions in npm install.
ER0015Pin versions in apk add.
ER0016Pin versions in gem install.
EW0001Use absolute WORKDIR.
EE0001Valid UNIX ports range from 0 to 65535.
EI0005Instructions should be uppercase.


You can help us develop linter by suggesting new rules and reporting bugs.


To run unit tests, use the command below:

npm run test


Docker Linter was created and developed by Buddy, creators of delivery automation tools for web and software developers.


The linter was created to validate the Dockerfile syntax in Continuous Integration and Delivery processes and can be used in any CI/CE tool. Buddy natively supports the linter, allowing you to create a pipeline that will check the syntax, build the Docker image and push it to the registry in a few simple steps:

  1. First, define when and for what refs (branchs / tags / pull requests) should the pipeline execute:

Docker Linter

  1. Next, add the Lint Dockerfile action and select the Dockerfile to validate:

Docker Linter

  1. Last, add the Docker build action that will build the image and push it to the registry.

Docker Linter

  1. You can extend the pipeline to automate other processes in your workflow. For example, automatically update the image on your K8s cluster and notify the QA team in case something goes wrong:

Docker Linter

Download Details:

Author: buddy-works
Source code: https://github.com/buddy-works/dockerfile-linter

License: GPL-3.0 license
#docker #nodejs 

Dockerfile Linter (written in Node.js)

Learn Angular : Dynamically Disable/Enable Multi Select Dropdown Options

Learn Angular : Dynamically Disable/Enable Multi Select Dropdown Options

In this Angular tutorial, you’ll learn how to disable or enable multi select dropdown options. You’ll also learn how to group data selection inside multi select dropdown options.

Source code from this tutorial is on GitHub https://github.com/jay3dec/Ang-MultiSelect-Group

#angular #multiselect #ng-multiselect-dropdown #disable

Learn Angular : Dynamically Disable/Enable Multi Select Dropdown Options
Delbert  Ferry

Delbert Ferry


Why You Should Disable GraphQL Introspection In Production

A public GraphQL API is one made primarily for consumption by developers _outside _ of your organization (like the Shopify or GitHub APIs). Whereas a private GraphQL API is one built to serve the client-side experiences for products built by developers _within _ your organization. The vast majority of us are building private GraphQL APIs .

#graphql #disable #introspection #production

Why You Should Disable GraphQL Introspection In Production

Mahesh Lalwani


How to Disable TextField In Flutter? | Flutter Tutorial | Flutter Agency

In this video, We will disable a Textfield using TextField widget in Flutter.

Related Article Link:- https://flutteragency.com/how-to-disable-textfield-in-flutter/

Please subscribe our channel : https://www.youtube.com/channel/UCQp3j50Q3tdkZVwYt-eEz9A

For more detail visit : https://FlutterAgency.com


#flutter #flutterdevelopment #disable #disabletextfield

How to Disable TextField In Flutter? | Flutter Tutorial | Flutter Agency
Manas Paul

Manas Paul


Wheels Galore | Iain M. MacLeod | wheelsgalore.scot


#best #book #disable #mental-heath #wheeks-galore #wheelsgalore

Wheels Galore | Iain M. MacLeod | wheelsgalore.scot
Rusty  Bernier

Rusty Bernier


Enable / Disable Automated Access Tier Change Rules in Azure Blob Storage-Daily .NET Tips

In this post, we will learn how to Enable / Disable Automated Access Tier Change Rules in Azure Blob Storage Azure Storage supports three different levels of storage tiers for Blob objects. They are Hot storage tier, Cool storage tier, and Archive storage tier. This enables cost-effective usages of blob data storage. With the different levels of storage tiers, you can choose what types of tier needs for your data. In the previous post, we have learned how we can Automatically update Access Tier in Azure Blob Storage

#azure #azure blob storage #.net #disable #enable #blob

Enable / Disable Automated Access Tier Change Rules in Azure Blob Storage-Daily .NET Tips