This package allows you to write your name to the console once in your ReactJS application.
npm install console-art-x
import { writeName } from 'console-art-x';
const App = () => {
const name = 'Bard';
useEffect(() => {
writeName(name);
}, []);
return (
<div>
<h1>{name}</h1>
</div>
);
};
export default App;
- import { writeName } from 'console-art-x';: We import the writeName function from the package.
- const name = 'Bard';: We assign the name you want to print to a variable.
- useEffect(() => { writeName(name); }, []);: We use the useEffect hook to run the writeName function when the component first renders.
You can customize the appearance of the text using the Patorjk website. This is an ASCII art generator that allows you to choose from a variety of fonts, colors, and sizes.
- Go to the patorjk website.
- Enter the text you want to print in the "Text" field.
- Select the font, color, and size you want from the drop-down menus.
- Click the "Generate" button.
- Copy the generated text.
- Paste the generated text into the writeName function call in your ReactJS code.
-
This package is for development purposes only. It should not be used in production.
-
The package works in the browser. It does not work in Node.js.
You can continue the link to see the live example : React Weather App
If you're wondering how to write packages like this, you can check out the blog I wrote about it. My Blog
If you encounter any problems, please open an issue on GitHub. My Github Profile
Thanks for using this package!