This is not GC related but I figured someone may b...
# prisma-whats-new
i
This is not GC related but I figured someone may be able to help me out. I’m currently using React & Apollo, along with GC, and I need some way to get the
data
object in my component’s
constructor()
. Does anyone know of an elegant way to do this? I haven’t tried wrapping it in a HOC yet so I’ll do that, which should work, but maybe someone has some insight that would help out
For example… (super contrived but hopefully you get my point)
Copy code
constructor(props) {
    super(props);
    this.state = {
      display: <User user={props.data.User} />
    }
  }

  onFriendClick() {
    this.setState({ display: <Friend user={this.props.data.Friend} /> });
  }
^ And then in the render method, I would just throw in
{this.state.display}
n
why do you need this? why isn't the usual approach with
this.props.data.user
enough?