Files
30-seconds-of-code/react/snippets/callto.md
Angelos Chalaris 462322f885 Prepare for merge
2023-05-01 22:56:37 +03:00

593 B

title, type, tags, author, unlisted, cover, dateModified
title type tags author unlisted cover dateModified
Callable telephone link snippet
components
chalarangelo true rabbit-call 2021-01-04T12:32:47+02:00

Renders a link formatted to call a phone number (tel: link).

  • Use phone to create a <a> element with an appropriate href attribute.
  • Render the link with children as its content.
const Callto = ({ phone, children }) => {
  return <a href={`tel:${phone}`}>{children}</a>;
};
ReactDOM.createRoot(document.getElementById('root')).render(
  <Callto phone="+302101234567">Call me!</Callto>
);