Posts

My First React.js Application

Image
I. Hello World App 1. install nodejs, visual studio code(extensions: simple react snippets, prettier code formatter) 2. cd for your project & type: npx   create-react-app my-app 3. cd my-app -> npm start 4. delete all files inside scr folder to start from scratch 5. Create index.js and type code below II. Creating a Counter App 1. npx create-react-app counter-app -> npm start 2. npm i bootstrap@4.1.1 3. in index.js import 'bootstrap/dist/css/bootstrap.css'; 4. create component folder inside src and create new file counter.jsx 5. type imrc(import react shortcut) & cc(class component shortcut) 6. in index.js import Counter from './components/counter' 7. in render method replace <App /> with <Counter /> 8. Copy the code below inside the class --It will increment & decrement the count when the corresponding button is clicked. That's it you can find the code in my github repo :  https://github.com/logronj/reactjs