How to transform content titles into slugs

How to transform content titles into slugs

You have a page of content and it has a title.

The title will contain spaces and strange characters you don’t want in the page’s URL.

Take this title: “Bounce processing, when SMTP server doesn’t return bounces properly”

You don’t want the spaces, the comma and the apostrophe to appear in the URL.

This is what the URL should look like: https://webwritertechandhumanity.com/item/109/bounce-processing-when-smtp-server-doesnt-return-bounces-properly

Why can’t URLs include spaces and non-alphanumeric characters?

How to do this in a React application?