What does ...rest mean in javscript?

What does ...rest mean in javscript?
0.0 0

#1

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>
    );


#2

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


#3

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


#4

~Micheal