Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix another Typo in README [How to Use.md] #39

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 17 additions & 14 deletions docs/how-to-use.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
# How to Use

Here are the basic of how to use callbacks and expose functions from the plugin. You can see the
list of APIs in this [API reference](api-reference.md).

## Expose functions

To access the expose functions, you will need to use **useRef** from react. Create a constant
variable that will hold the **useRef()** and pass it in **TawkMessengerReact** component as a prop.

Expand All @@ -24,29 +26,30 @@ function App() {
<TawkMessengerReact
propertyId="property_id"
widgetId="default"
useRef={tawkMessengerRef}/>
ref={tawkMessengerRef}/>
</div>
);
}
```

## Using Callbacks

Using the API callbacks, pass a function as props on the callback you will used.

```js
function App() {
const onLoad = () => {
console.log('onLoad works!');
};

return (
<div className="App">
<TawkMessengerReact
propertyId="property_id"
widgetId="default"
onLoad={onLoad}/>
</div>
);
const onLoad = () => {
console.log('onLoad works!');
};

return (
<div className="App">
<TawkMessengerReact
propertyId="property_id"
widgetId="default"
onLoad={onLoad}
/>
</div>
);
}
```