The first step of the configuration step is to install create-react-app globally. Make sure you have node and npm installed on your computer. (int) The current month starting from 1 - 12Įxport const THIS_MONTH = +(new Date().In this tutorial, you will need a configured computer and also basic Javascript & React knowledge. Add the following code to the src/helpers/calendar.js file: // (int) The current yearĮxport const THIS_YEAR = +(new Date().getFullYear()) In the calendar helpers module we created earlier, we’ll define some helpers and constants, which we’ll export as named exports. You’ll notice that a new browser tab has opened for you with live reloading functionality, keeping in sync with changes in the application. Start the application by running either of the following commands in your terminal: //yarn To create a file for the calendar helpers module, run the following commands: mkdir -p src/helpers Our application doesn’t require any external dependencies to handle dates. Mkdir -p src/components/Calendar src/components/DatepickerĬd src/components/Calendar & touch index.js styles.jsĬd src/components/Datepicker & touch index.js styles.js To create the component directories and files, run the following commands from your project’s root directory: # Create directories The index.js file exports the component, while the styles.js file exports styled-components, which is required by the component to add styling. We’ll store each component in its own directory with two files, index.js and styles.js. datepicker: Renders a date input and presents the calendar for the user to select the date.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |