GroceriStar / react-only-intern-17

GNU General Public License v3.0
0 stars 0 forks source link

Master React, Quick Code tutorial. Part 3 #4

Open atherdon opened 6 years ago

atherdon commented 6 years ago

https://medium.com/quick-code/lets-learn-react-chapter-3-components-components-components-3492f771d623

Expected result

Test

chefigueroa-rodriguez commented 6 years ago

Starting to get a little more fun now. We are modularizing our App and breaking it down into sections easier to work with. We created our components directory and created 2 components and imported them into our app. I also learned the appropriate syntax to return multiple components to my view. There are two ways to return multiple components:

  1. Wrap the components in a
    tag
  2. Return an Array of elements
chefigueroa-rodriguez commented 6 years ago

Do you me to sort through the current week of the year or the current week of the current month?

atherdon commented 6 years ago

please move to the next chapter, i'll require some time in order to review your code

atherdon commented 6 years ago

i'm back, sorry for taking so long. have 5 days without internet - so amazing time. i did so much analytical work! And then i was inspired to code and all next time i was replying to messages that came to my inbox during that time :)

ok, to asnwers

I want to have one array - that will contain days and month together. so when you'll need to render a 'calendar' table - you'll use 2 forEach methods. Q: Do you me to sort through the current week of the year or the current week of the current month? i understand your question. For this particular moment - this is just upon you. Main goal of this task was to mimic working process on real project. let's assume that you have database with calendar data. and you grab that data from your server. you receive a 2n structured array, that contains days for a whole month. and your task is about to draw a component(HTML tags) that related to displaying month. So yeah, you can grab a current month number -> count days -> form a 2n array and then, by using 2 loops - display data at your component.

This looks like a right approach: https://github.com/GroceriStar/react-only-intern-17/blob/master/src/components/MonthChecker.js#L19-L34

if you want to advance your skills, you can create a data for a whole 2018 year and display a few months, with active May.


and i want to have all static data - like titles, image url, content - into one file, make it like array. not sure if you did it, so will explain: check this line: https://github.com/GroceriStar/react-only-intern-17/blob/master/src/components/MealPlan.js#L17-L21

you're using some static data to put inside your component. i want to have a separated place for such type of data. i mean - this will make component more clean and less complex - which is a good approach for a long term

atherdon commented 6 years ago

@che607 can you tell me - should i close this task, right?