How to use apiFetch to get author information in Gutenberg properly?
Finally, I found out how to do it. Just call fetchApi in componentDidMount and then create a new state in your component and add the response to this state when the request is done: constructor(props) { super(props); this.state = { data: {}, }; } componentDidMount() { apiFetch( { path: ‘/wp/v2/users/1’ } ) .then(data => this.setState({ … Read more