I would use the two REST-Endpoints suggested in my comment. First call to get the user ID and after that the second call to get the groups in which the user is member.
import { SPHttpClient, SPHttpClientResponse, ISPHttpClientOptions } from '@microsoft/sp-http';
var absoluteUri = this.props.context.pageContext.web.absoluteUrl;
this.props.context.spHttpClient.get(absoluteUri + "/_api/Web/CurrentUser?$select=ID",
SPHttpClient.configurations.v1)
.then((userResponse: SPHttpClientResponse) => {
userResponse.json().then((user: any) => {
var userId = user.Id;
this.props.context.spHttpClient.get(absoluteUri + "/_api/Web/GetUserById(" + userId + ")/Groups",
SPHttpClient.configurations.v1)
.then((groupResponse: SPHttpClientResponse) => {
groupResponse.json().then((groupsData: any) => {
var groups = groupsData.value;
groups.forEach(group => {
if(group.Title == "TARGETGROUP") {
// DISPLAY DIV
}
});
});
});
});
});
You have to get the current Context from the WebPart. In my example I use a component and get the context from the properties (this.props.context).
/api/Web/CurrentUser
and after that/api/Web/GetUserById(<USERID>)/Groups
?