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 } from "react"; | |
| import logo from "./logo.svg"; | |
| import "./App.css"; | |
| function Counter(props) { | |
| return ( | |
| <h1>{props.value} 💪</h1> | |
| ); | |
| } | |
| class App extends Component { |
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 } from "react"; | |
| import logo from "./logo.svg"; | |
| import "./App.css"; | |
| import NumberContext from "./context"; | |
| function Counter(props) { | |
| return ( | |
| //by using consumer we are using value in our component. | |
| // we need to use a function to get our value | |
| <NumberContext.Consumer>{val => <h1>{val} 💪</h1>}</NumberContext.Consumer> |
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
| *{ | |
| box-sizing: border-box; | |
| margin: 0; | |
| padding: 0; | |
| } | |
| body{ | |
| padding: 2rem; | |
| } | |
| ul{ |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>React</title> | |
| </head> | |
| <body> | |
| <div class="connect"> |
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": "reactscratch", | |
| "version": "1.0.0", | |
| "description": "Create react app from scratch", | |
| "keywords": [ | |
| "react-app","scratch" | |
| ], | |
| "main": "index.js", | |
| "scripts": { | |
| "watch": "webpack --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
| const webpack = require('webpack'); | |
| const path = require('path'); | |
| const HtmlWebpackPlugin = require('html-webpack-plugin'); | |
| const MiniCssExtractPlugin = require("mini-css-extract-plugin"); | |
| const UglifyJsPlugin = require('uglifyjs-webpack-plugin') | |
| module.exports={ | |
| devServer: { | |
| contentBase: path.join(__dirname, "dist"), |
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
| <!DOCTYPE html> | |
| <html lang="en"> | |
| <head> | |
| <meta charset="UTF-8"> | |
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
| <meta http-equiv="X-UA-Compatible" content="ie=edge"> | |
| <title>React from scratch</title> | |
| </head> | |
| <body> |
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 } from "react"; | |
| class App extends Component { | |
| render() { | |
| return ( | |
| <div style={{ textAlign: "center", marginTop: "10rem" }}> | |
| <h1>App is there</h1> | |
| <p> | |
| What is Lorem Ipsum? | |
| Lorem Ipsum is simply dummy text of the printing and typesetting industry. Lorem Ipsum has been the industry's standard dummy text ever since the 1500s, when an unknown printer took a galley of type and scrambled it to make a type specimen book. It has survived not only five centuries, but also the leap into electronic typesetting, remaining essentially unchanged. It was popularised in the 1960s with the release of Letraset sheets containing Lorem Ipsum passages, and more recently with desktop publishing software like Aldus PageMaker including versions of Lorem Ipsum. |
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 Loading from '../components/Loading'; | |
| import Loadable from 'react-loadable'; | |
| export const App=Loadable({ | |
| loader:()=>import('../components/App'), | |
| loading:Loading | |
| }) | |
| export const Posts =Loadable({ |
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 { Route } from "react-router-dom"; | |
| import Header from "../header"; | |
| import {App,Posts} from './lazy' | |
| class ReactRouter extends React.Component { | |
| render() { |