1.0.12 • Published 2 years ago
react-extension-methods v1.0.12
react-extension-methods
This package contains few string utility methods
NPM Documents
This utility contains few extension methods are are useful for everyday coding.
How to Install
npm install react-extension-methods
How To Use
Use in the App.js
import ExtensionMethods from "react-extension-methods"; function App() { let city = "i live in new york" return ( <div> <ExtensionMethods> <h1>{city.toCapitalCase()}</h1> <h1>{city.slug()}</h1> </ExtensionMethods> </div> ) }
You can also import and use this in index.js
import React from "react"; import ReactDOM from "react-dom"; import "./index.css"; import App from "./App"; import reportWebVitals from "./reportWebVitals"; import ExtensionMethods from "react-extension-methods"; ReactDOM.render( <React.StrictMode> <ExtensionMethods> <App /> </ExtensionMethods> </React.StrictMode>, document.getElementById("root") ); // If you want to start measuring performance in your app, pass a function // to log results (for example: reportWebVitals(console.log)) // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals reportWebVitals();
Current List of Available Methods
Method Name | Data Type That It Works on | Sample Input | Sample Output |
---|---|---|---|
toCapitalCase | String | i live in new york | I Live In New York |
slug | String | i live in new york | i-live-in-new-york |