Stream the contents of each file using web sockets and ReactJs

前端 未结 1 1969
一向
一向 2021-01-26 07:03

I am trying to read files of a directory and usin socket i have to render the file name and file data using React.

here is what i have done:

Server :

         


        
相关标签:
1条回答
  • 2021-01-26 07:43

    You can't mutate the state by doing this.state.data.push(msg);

    Try

    var data = this.state.data;
    data.push(msg);
    this.setState({data: data});
    
    0 讨论(0)
提交回复
热议问题