All pages
Powered by GitBook
1 of 1

Using as a whole feature with the default settings

This is the quickest way to start using the Community feature. All the default logic and navigations have already been defined.

Web Social UIKit

Usage

First, you need to get your api key and authToken from the authorization server. Then, to render the whole social kit:

import { AmityUiKitProvider, AmityUiKitSocial } from '@amityco/ui-kit';

function MyApp() {
  return (
    <AmityUiKitProvider
      apiKey={...}
      authToken={...}
      userId="myUserId"
      displayName="myUserName"
    >
      <AmityUiKitSocial />
    </AmityUiKitProvider>
  );
}

To render the user feed only:

import { PostTargetType } from '@amityco/js-sdk'
import { AmityUiKitProvider, AmityUiKitFeed } from '@amityco/ui-kit';

function UserFeedPage({ user, isMe }) {
  return (
    <AmityUiKitProvider
  	apiKey={...}
  	authToken={...}
  	userId="myUserId"
  	displayName="myUserName"
    >
  	<AmityUiKitFeed
        targetType={isMe ? PostTargetType.MyFeed : PostTargetType.UserFeed}
        targetId={user.userId}
        showPostCreator={isMe}
      />
    </AmityUiKitProvider>
  );
}