Files
30-seconds-of-code/snippets/Callto.md
2022-02-09 09:50:57 +02:00

573 B

title, tags, unlisted, firstSeen, lastUpdated
title tags unlisted firstSeen lastUpdated
Callable telephone link components,beginner true 2020-10-04T00:07:37+03:00 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.render(
  <Callto phone="+302101234567">Call me!</Callto>,
  document.getElementById('root')
);