<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://unpkg.com/react@17.0.2/umd/react.production.min.js"></script>
<script src="https://unpkg.com/react-dom@17.0.2/umd/react-dom.production.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.26.0/babel.min.js"></script>
<script type="text/babel">
const inputString = "United State America";
// Split the input string into words
const words = inputString.split(' ');
// Map over the words and extract the first letter of each word
const firstLetters = words.map(word => word[0]);
// Join the first letters back into a string
const resultString = firstLetters.join('');
<div className='container'>
<h3 className='title'>React Js Get first letter of each word in a string</h3>
<p className='input-text'>Input String: {inputString}</p>
<p className='result-text'>First Letters: {resultString}</p>
ReactDOM.render(<App />, document.getElementById("app"));
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
/* Styles for the title */
/* Styles for the input-text */
/* Styles for the result-text */