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
| const reducer = (state, action) => { | |
| switch (action.type) { | |
| case 'increment': { | |
| return { ...state, count: state.count + 1, loading: false }; | |
| } | |
| case 'decrement': { | |
| return { ...state, count: state.count - 1, loading: false }; | |
| } | |
| case 'loading': { | |
| return { ...state, loading: true }; |
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
| import React, { useReducer } from 'react'; | |
| const initialState = { | |
| loading: false, | |
| count: 0, | |
| }; | |
| const reducer = (state, action) => { | |
| switch (action.type) { | |
| case 'increment': { |
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
| import React, { Component, Fragment } from 'react'; | |
| import { Link } from 'react-router-dom'; | |
| import { Prompt } from 'react-router'; | |
| import { Form, Icon } from 'antd'; | |
| import { I18n } from 'react-i18next'; | |
| import { Modal, ModalHeader, ModalBody, ModalFooter } from 'reactstrap'; | |
| import { | |
| GetMedications, | |
| CompleteReport, | |
| ChangeReportStatus, |
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
| import React from 'react'; | |
| import { shallow } from ‘enzyme’; | |
| // Components | |
| import WelcomeMessage from './WelcomeMessage'; | |
| function setup() { | |
| const props = { | |
| imgPath: 'some/image/path/to/a/mock/image', | |
| }; |
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
| import React, { Fragment } from 'react'; | |
| const styles = { | |
| heading: { | |
| color: '#fff', | |
| textAlign: 'center', | |
| marginBottom: 15, | |
| }, | |
| logo: { | |
| width: 250, |
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
| /** Used in jest.config.js */ | |
| import { configure } from 'enzyme'; | |
| import Adapter from 'enzyme-adapter-react-16'; | |
| configure({ adapter: new Adapter() }); |
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
| // For a detailed explanation regarding each configuration property, visit: | |
| // https://jestjs.io/docs/en/configuration.html | |
| module.exports = { | |
| // Automatically clear mock calls and instances between every test | |
| clearMocks: true, | |
| // An array of glob patterns indicating a set of files for which coverage information should be collected | |
| collectCoverageFrom: ['src/**/*.{js,jsx,mjs}'], |
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
| { | |
| "name": "react-boiler-plate", | |
| "version": "1.0.0", | |
| "description": "A react boiler plate", | |
| "main": "src/index.js", | |
| "author": "Adeel Imran", | |
| "license": "MIT", | |
| "scripts": { | |
| "test": "jest", | |
| "test:watch": "jest --watch", |
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
| # EditorConfig is awesome: http://EditorConfig.org | |
| # top-most EditorConfig file | |
| root = true | |
| [*.md] | |
| trim_trailing_whitespace = false | |
| [*.js] | |
| trim_trailing_whitespace = true |
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
| { | |
| "editor.formatOnSave": false, | |
| "eslint.autoFixOnSave": true, | |
| } |