What does ...rest mean in javscript?

in a part of react project

render() {
        const {
          horizontal,
          className,
          children,
          ...rest,
        } = this.props;
        const cx = classNames({
          'form-horizontal': horizontal,
        }, className);
        return (
          <form className={cx} {..rest}>
            {children}
          </form>
        );
      }
    };

    const Field = ({ children, ..rest }) => (
      <div className="form-group">
        {children}
      </div>
    );

…

Watch this video https://youtu.be/j2DMwUYEC88

1 Like

I just begin learning js and you helped me discover a new shiny thing called ES6! I couldn’t even find this in “advanced” section of MDN. You are so helpful. Thank you xD

~Micheal

1 Like