A WhatsappShare
component will help you to open whatsapp
directly and share
the message
. You can provide a pre-defined
mobile number
and share the details directly in a specific number
as well.
A minimal Demo Link
Value | Used as a | Description |
---|---|---|
WhatsappShare | ✅ Component | Can be used as Component |
whatsappShare | ✅ Service | Can be used as Service |
// Default import will return WhatsappShare Component
import WhatsappShare from 'fe-pilot/WhatsappShare';
<WhatsappShare /> // Used as a Component
import { WhatsappShare, whatsappShare } from 'fe-pilot/WhatsappShare';
<WhatsappShare /> // Used as a Component
whatsappShare(); // Used as a Service
import { WhatsappShare } from 'fe-pilot/WhatsappShare';
const successCb = (response) => {
console.log("success response:", response);
}
const failureCb = (response) => {
console.log("failure response:", response);
}
return (
<WhatsappShare
successCb={successCb}
failureCb={failureCb}
mobile="7204535372"
msg="Welcome to fe-pilot"
>
Pass clickable element (button, anchor etc) here to bind onClick event
</WhatsappShare>
);
Props | Type | Description | Response |
---|---|---|---|
successCb | Function | It will be called on success |
{ data: "Can be array/object/string/number", msgType: "SUCCESSFUL", msg: "A success msg", status: "SUCCESS" } |
loadingCb | Function | It will be called before success/failure. |
{ msgType: "LOADING", msg: "LOADING...", status: "LOADING" } |
failureCb | Function | It will be called on failure |
{ msgType: "ERROR", msg: "A failed msg", status: "FAILURE" } |
Props | Type | Description | Default Values |
showForever | Boolean | To hide/remove unsupported feature, make it false. | Default value is true. |
mobile | number | Provide a mobile number to open directly | --- |
msg | String | Provide a message to send to user | --- |