menu
techminis

A naukri.com initiative

google-web-stories
Home

>

Programming News

>

Making a u...
source image

Medium

3w

read

340

img
dot

Image Credit: Medium

Making a utility function to convert text to bold and italic in React

  • Creating a utility function in React to convert text to bold and italic without using a package like React Markdown.
  • The function checks for special characters like *, **, _ in the text string and converts the related parts to bold, italic, or both.
  • It splits the text string using Regex to identify the parts that need formatting and applies appropriate CSS class names.
  • A React component is used to wrap the formatted parts of text in elements with class names for styling.

Read Full Article

like

20 Likes

For uninterrupted reading, download the app