├── public ├── favicon.ico ├── manifest.json └── index.html ├── src ├── Components │ ├── styles.scss │ └── App.jsx └── index.js ├── .gitignore ├── README.md └── package.json /public/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pranesh239/react-component-patterns/master/public/favicon.ico -------------------------------------------------------------------------------- /src/Components/styles.scss: -------------------------------------------------------------------------------- 1 | body { 2 | font-family: sans-serif; 3 | h1 { 4 | color: tomato; 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import React from "react"; 2 | import ReactDOM from "react-dom"; 3 | import App from "./Components/App"; 4 | 5 | ReactDOM.render(, document.querySelector("#root")); 6 | -------------------------------------------------------------------------------- /public/manifest.json: -------------------------------------------------------------------------------- 1 | { 2 | "short_name": "React App", 3 | "name": "Create React App Sample", 4 | "icons": [ 5 | { 6 | "src": "favicon.ico", 7 | "sizes": "64x64 32x32 24x24 16x16", 8 | "type": "image/x-icon" 9 | } 10 | ], 11 | "start_url": ".", 12 | "display": "standalone", 13 | "theme_color": "#000000", 14 | "background_color": "#ffffff" 15 | } 16 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files. 2 | 3 | # dependencies 4 | /node_modules 5 | /.pnp 6 | .pnp.js 7 | 8 | # testing 9 | /coverage 10 | 11 | # production 12 | /build 13 | 14 | # misc 15 | .DS_Store 16 | .env.local 17 | .env.development.local 18 | .env.test.local 19 | .env.production.local 20 | 21 | npm-debug.log* 22 | yarn-debug.log* 23 | yarn-error.log* 24 | -------------------------------------------------------------------------------- /src/Components/App.jsx: -------------------------------------------------------------------------------- 1 | import React, { Component } from "react"; 2 | import "./styles.scss"; 3 | class App extends Component { 4 | state = {}; 5 | render() { 6 | return ( 7 |

8 | 9 | 🚨 10 | 11 | Please check the branches for Patterns 12 | 13 | 🚨 14 | 15 |

16 | ); 17 | } 18 | } 19 | 20 | export default App; 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # React Component Patterns 🎲 2 | 3 | ### 🚨 Each branch in this repo carries a pattern 🚨 4 | 5 | alt text 6 | 7 | #### Component patterns: 8 | 9 | - [Compound component pattern](https://github.com/pranesh239/react-component-patterns/tree/compound-components) 10 | - [Render props pattern](https://github.com/pranesh239/react-component-patterns/tree/render-props) 11 | 12 | [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg?style=flat-square)](http://makeapullrequest.com) 13 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-component-patterns", 3 | "version": "0.1.0", 4 | "private": true, 5 | "dependencies": { 6 | "node-sass": "^4.12.0", 7 | "react": "^16.8.6", 8 | "react-dom": "^16.8.6", 9 | "react-scripts": "3.0.1" 10 | }, 11 | "scripts": { 12 | "start": "react-scripts start", 13 | "build": "react-scripts build", 14 | "test": "react-scripts test", 15 | "eject": "react-scripts eject" 16 | }, 17 | "eslintConfig": { 18 | "extends": "react-app" 19 | }, 20 | "browserslist": { 21 | "production": [ 22 | ">0.2%", 23 | "not dead", 24 | "not op_mini all" 25 | ], 26 | "development": [ 27 | "last 1 chrome version", 28 | "last 1 firefox version", 29 | "last 1 safari version" 30 | ] 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /public/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 12 | 13 | 22 | React App 23 | 24 | 25 | 26 |
27 | 37 | 38 | 39 | --------------------------------------------------------------------------------