|
@@ -322,4 +322,33 @@ const { details } = this.props
|
|
- leave
|
|
- leave
|
|
- appear
|
|
- appear
|
|
|
|
|
|
-## Video 23: Authentication
|
|
|
|
|
|
+## Video 23: Component Validation with PropTypes
|
|
|
|
+* When sharing components with other people, use PropTypes to declared what needs to be passed to them.
|
|
|
|
+
|
|
|
|
+```jsx
|
|
|
|
+const Header = function() {...}
|
|
|
|
+Header.propTypes = {
|
|
|
|
+ tagline: React.PropTypes.string.isRequired
|
|
|
|
+}
|
|
|
|
+```
|
|
|
|
+
|
|
|
|
+## Video 24: Authentication
|
|
|
|
+
|
|
|
|
+## Video 25: Building React for Production
|
|
|
|
+* If you start with create-react-app, you can use `npm build`
|
|
|
|
+* creates optimized js and css files in the `build` folder.
|
|
|
|
+* when you deploy, you need to catch the URL routing and let react-router handle URLs.
|
|
|
|
+* otherwise, on reloads serving index.html will fail.
|
|
|
|
+
|
|
|
|
+## Video 28: Deploying to Apache Server
|
|
|
|
+* Depending whether you run from the root or a subdirectory, you need to specify `<BrowserRouter basename='/somefolder'>` or not.
|
|
|
|
+* You also neet to specify this in package.json under "homepage"
|
|
|
|
+* Put the files on the server
|
|
|
|
+* in .htaccess define
|
|
|
|
+```
|
|
|
|
+RewriteBase /
|
|
|
|
+RewriteRule ^index\.html$ - [L]
|
|
|
|
+RewriteCond %{REQUEST_FILENAME} !-f
|
|
|
|
+RewriteCond %{REQUEST_FILENAME} !-d
|
|
|
|
+RewriteRule . /index.html [L]
|
|
|
|
+```
|