Created
October 11, 2017 11:08
-
-
Save kastigar/21432511ee938354a0a06f514f548957 to your computer and use it in GitHub Desktop.
"Data first" example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
daysByWeek = [ | |
{ days: [{ number: 31, other: true }, { number: 1 }, { number: 2, current: true }] }, | |
{...}, | |
{...}, | |
] | |
*/ | |
function Calendar(props) { | |
const daysByWeek = calculateDaysByWeek(props.date); | |
return ( | |
<div> | |
{"..."} | |
{daysByWeek.map(week => ( | |
<tr> | |
{week.days.map(day => ( | |
<td>{day.number}</td> | |
)} | |
</tr> | |
)} | |
{"..."} | |
</div> | |
); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment