Skip to content

Commit d662769

Browse files
committed
update links and prerequisites section.
1 parent 0298e90 commit d662769

File tree

1 file changed

+35
-30
lines changed

1 file changed

+35
-30
lines changed

content/chat/getting-started/react.textile

+35-30
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
---
22
languages:
33
- react
4-
title: "Getting started: Chat With React"
4+
title: "Getting started: Chat with React"
55
meta_description: "A getting started guide for Ably Chat React that steps through some of the key features using React and Vite."
66
meta_keywords: "Ably, realtime, quickstart, getting started, basics, Chat, React, Vite"
77
---
@@ -22,8 +22,8 @@ h2(#prerequisites). Prerequisites
2222

2323
h3(#prerequisites-ably). Ably
2424
* Sign up for an Ably account
25-
* Create a new app and get your API key
26-
* Your API key will need the `publish`, `subscribe`, `presence` and `history` capabilities
25+
** Create a new app and get your API key
26+
** You can use the root API key that is provided by default to get started.
2727

2828
h3(#prerequisites-ably-cli). Ably-CLI
2929

@@ -44,25 +44,16 @@ h3(#prerequisites-create-project). Create a React Project
4444

4545
Create a new React + TypeScript project using Vite. For detailed instructions, refer to the "Vite documentation":https://vitejs.dev/guide/#scaffolding-your-first-vite-project.
4646

47-
<aside data-type='note'>
48-
<p>You should see a directory structure similar to this:</p><code>
49-
├── index.html
50-
├── package.json
51-
├── public
52-
├── src
53-
│ ├── App.tsx
54-
│ ├── main.tsx
55-
│ ├── App.css
56-
│ └── vite-env.d.ts
57-
├── tsconfig.app.json
58-
├── tsconfig.json
59-
├── tsconfig.node.json
60-
└── vite.config.ts
61-
</code>
62-
</aside>
47+
```[sh]
48+
npm create vite@latest my-chat-react-app -- --template react-ts
49+
```
6350

6451
You will also need to setup Tailwind CSS for styling the application. For installation instructions, see the "Tailwind CSS documentation for Vite":https://tailwindcss.com/docs/guides/vite.
6552

53+
```[sh]
54+
npm install tailwindcss @tailwindcss/vite
55+
```
56+
6657
h3(#prerequisites-ably-chat). Ably Chat SDK
6758

6859
Ensure you have installed the Ably Chat SDK, this will also install the Ably Pub/Sub SDK as a dependency:
@@ -113,8 +104,6 @@ ReactDOM.createRoot(document.getElementById('root')!).render(
113104
);
114105
```
115106

116-
Ensure you replace the @{{API_KEY}}@ placeholder with your actual Ably API key.
117-
118107
h2(#imports). Required Imports
119108

120109
You will need to import the following modules in your @src/App.tsx@ file, these will be used at various points in the guide:
@@ -143,10 +132,23 @@ This enables them to send and receive messages in realtime across channels. You
143132

144133
```[react]
145134
// App.tsx
146-
function ConnectionStatus() {
147-
// This component will display the current connection status
148-
const { currentStatus } = useChatConnection(); // Hook to get the current connection status
135+
import React, {useCallback, useEffect, useState} from 'react';
136+
import "./App.css";
137+
import {
138+
AllFeaturesEnabled,
139+
ChatRoomProvider,
140+
MessageEvents, Reaction, useChatConnection,
141+
useMessages,
142+
usePresence,
143+
usePresenceListener, useRoom, useRoomReactions,
144+
useTyping
145+
} from '@ably/chat';
146+
import {MessageEvent, Message} from '@ably/chat';
149147

148+
// This component will display the current connection status
149+
function ConnectionStatus() {
150+
// Hook to get the current connection status
151+
const { currentStatus } = useChatConnection();
150152
return (
151153
<div className="p-4 text-center h-full border-gray-300 bg-gray-100">
152154
<h2 className="text-lg font-semibold text-blue-500">Ably Chat Connection</h2>
@@ -826,12 +828,15 @@ h2(#next). Next steps
826828

827829
Continue exploring Ably Chat with React:
828830

829-
* Read more about using [rooms](https://ably.com/docs/chat/rooms) and sending [messages](https://ably.com/docs/chat/rooms/messages).
830-
* Learn about [presence status](https://ably.com/docs/chat/rooms/presence).
831-
* Set up [typing indicators](https://ably.com/docs/chat/rooms/typing).
832-
* Send [reactions](https://ably.com/docs/chat/rooms/reactions) to express real-time feedback.
833-
* Investigate pulling messages from [history](https://ably.com/docs/chat/rooms/history) for context.
831+
Read more about the concepts covered in this guide:
832+
* Read more about using "rooms":/docs/chat/rooms and sending "messages":/docs/chat/rooms/messages.
833+
* Find out more regarding "online status":/docs/chat/rooms/presence.
834+
* Understand how to use "typing indicators":/docs/chat/rooms/typing.
835+
* Send "reactions":/docs/chat/rooms/reactions to your rooms.
836+
* Read into pulling messages from "history":/docs/chat/rooms/history and providing context to new joiners.
837+
* Understand "token authentication":/docs/authentication/token-authentication before going to production.
834838

835-
Explore the Ably CLI further, or check out the [Chat JS API references](https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/modules/chat-js.html) for additional functionality.
839+
Explore the Ably CLI further,
840+
or check out the "Chat JS API references":https://sdk.ably.com/builds/ably/ably-chat-js/main/typedoc/modules/chat-js.html for additional functionality.
836841

837842

0 commit comments

Comments
 (0)