Skip to content
This repository was archived by the owner on Jan 26, 2019. It is now read-only.
This repository was archived by the owner on Jan 26, 2019. It is now read-only.

i found if we are using rest props of es6 spread operator it will broken in below behaivor? #64

Closed
@tianyingchun

Description

@tianyingchun
import * as React from 'react';
import Demo2 from './Demo2';

export default class XX extends React.Component<any, any> {

  render() {
    // console.log(Demo2);
    const { children, ...restProps } = this.props;
    // const x= {};
    console.log(restProps);
    return (
      <div>demo1 {this.props.name}
        <div {...restProps}>
          <Demo2></Demo2>
        </div>
      </div>
    )
  }
}

if we use above code block the vs.code will give me the Demo2 is declared but not used, while build process, it will lose is undefined.

if we change {...restProps} to {...x} it works fine. why?

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy