(Desktop only) Create a community
(Desktop only) Create a community in Bitsocial React Hooks. Usage, options, and examples.
const createCommunityOptions = { title: "My community title" };
const { createdCommunity, createCommunity } = useCreateCommunity(createCommunityOptions);
await createCommunity();
// it is recommended to redirect to `p/${createdCommunity.address}` after creation
if (createdCommunity?.address) {
console.log("created community with title", createdCommunity.title);
history.push(`/p/${createdCommunity.address}`);
}
// after the community is created, fetch it using
const { accountCommunities } = useAccountCommunities();
const accountCommunityAddresses = Object.keys(accountCommunities);
const communities = useCommunities({
communities: accountCommunityAddresses.map((communityAddress) => ({ name: communityAddress })),
});
// or
const _community = useCommunity({ community: { name: createdCommunity.address } });