I am passing an array which contains the following credentials.:
//Snippet variable contains an array which looks like this
{
details: test, 
_id: "5d9d0b506ee7d03a54d8b1f6", 
name: "TEST GREEN", 
content: "<div style="background-color:green; height:100px; width:100px;"></div>", 
}
The array is recieved by a function, the function updates the state. The state looks like this:
  constructor(props) {
    super(props)
    this.showModal = React.createRef()
    this.state = {
      snippets: [],
      edit: null,
      show: false,
      sid: '',
    }
  }
The function looks like this
  handleModal = snippet => {
    console.log(snippet) //pastes output found in the snippet array above
    console.log(this.state) //{snippets: Array(3), edit: null, show: false, sid: ""}
    this.setState({ edit: this.snippet })
    console.log(this.state)//{snippets: Array(3), edit: null, show: false, sid: ""}
    this.setState({ sid: snippet._id })
    this.showModal.current.showModal()
  }
I know I have two setStates. I am trying to isolate the problem.
edit: null in the state should be becoming edit: Array(1) but setState seems to be failing. 
 
     
     
     
     
    