Creating a Travel Journal
using ReactJS
A Travel Journal
, created to practice ReactJS
. It includes descriptions of places that I have visited along with some future adventures. Journal Entries contain Title, Location, Google Maps Link, Start Date, End Date, Description and Image.Journal Entries are created dynamically using the .map() method and props on the data.js
file, which is an array of objects. While creating this project I learned about React Props
, Creating Components from an Array
, using Mapping Components
, etc. After creating the project, it was deployed to github-pages
π¦ Feel free to reach me at Twitter π
- NPM
- ReactJS
- Custom Components
- create-react-app
- Figma
- React Props
- Creating Components from an Array
- Mapping Components
- github-pages
cd travel-journal
npm install
npm start
- Initailize the project using
npx create-react-app travel-journal
which will create a complete React App pre-configured and pre-installed with all the dependencies. - Import
Inter
font from google fonts and apply it toApp
component.
- Create a
components
folder insidesrc
directory. - Create future custom components inside
components
folder. - Create an
images
folder insidesrc
directory and add images/logos inside it.
- Delete unnecessary files and code from directory.
- Create
Navbar
component and basic JSX elements for it. - Add appropriate
className
s to elements inNavbar
component. - Add
globe.png
image toNavbar
component. - Import
Navbar
component insideApp
component. - Style
Navbar
andApp
component .
- Create
Card
component and basic JSX elements for it. - Add appropriate
className
s to elements inCard
component. - Add photos to
Card
component. - Import
Card
component insideApp
component. - Add basic style to
Card
component.
- Create
Footer
component and basic JSX elements for it. - Import
Footer
component insideApp
component. - Style
Footer
component.
- Create a file called
data.js
, which contains an array of objects. It represents the data that will be used insideCard
component. - Import images for
Card
component. - Use .map to iterate over array of objects inside
data.js
to createCard
components. - When we .map over array of objects in
App
component, Add key prop ποΈ (key={item.id}
) when passing props toCard
components. This will get rid of this warning :
β οΈ react_devtools_backend.js:4026 Warning: Each child in a list should have a unique "key" prop.
Check the render method of `App`. See https://reactjs.org/link/warning-keys for more information.
at Card (http://localhost:3000/main.5c1f9e47e1f13a06e783.hot-update.js:27:18)
at App
- Add flexbox style to
.cards-list
div and other necessary styles. - Add a media query for
max-width: 600px
. - App is responsive upto this point. π
- Pass entire object when we .map over array of objects in
App
component using item as key and array of objects as its value. - Access the object that is passed as prop in
Card
component, where item is key and array of objects are its values.
- We can make use of
{...item}
Spread in Object Literals, which takes properties of our object and create a separate prop for each key in object. Value of props can be accessed usingprops.key
syntax, where key is an actual key indata.js
. This is an alternate to instead of creating our own prop called item to which we pass our entire object.Spread object as props(Option #2) πΌ
is used in this project.
- Create total of 7 unique
Card
components(journal entries) inside.cards-list
by updatingdata.js
. - Delete unnecessary files from directory and format code with
Prettier
. - Test for Responsiveness and make changes if need be β .
- Add links to
Live Preview
and screenshots β .
- Use Official Documentation(link) to push project to GitHub Pages πππ
-
The Odin Project
-
Figma Design
-
Scrimba
-
React Official Documentation
-
YouTube
-
FreeCodeCamp
-
MDN
-
Images
βThe science of operations, as derived from mathematics more especially, is a science of itself, and has its own abstract truth and value.β
β Ada Lovelace
π― π» π