Beanbrothers season3 header
In React universal application, there is problem when render client-side only components like Devtools, fetching components and webpack style require (require css) Two solution for this.
dynamic module import isomorphic500
check js is running on browser
use webpack also on serverside, or if you are using requirejs, you can map client modules to null
But serverside build look like overkill to me, I choose dynamic module import. However in es6, import doesn't support dynamic import. So you should use commonjs require for it.
This file contains 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> | |
<head> | |
<meta charset="utf-8"> | |
<title>React 1</title> | |
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react.min.js'></script> | |
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react-dom.min.js'></script> | |
</head> | |
<body> | |
<div id="root"></div> |
This file contains 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> | |
<head> | |
<meta charset="utf-8"> | |
<title>like react1</title> | |
</head> | |
<body> | |
<div id="root"></div> | |
<script> | |
function render(elem, root) { |
This file contains 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> | |
<head> | |
<meta charset="utf-8"> | |
<title>React 2</title> | |
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react.min.js'></script> | |
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react-dom.min.js'></script> | |
</head> | |
<body> | |
<div id="root"></div> |
This file contains 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> | |
<head> | |
<meta charset="utf-8"> | |
<title>React 1</title> | |
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react.min.js'></script> | |
<script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react-dom.min.js'></script> | |
<script src='https://cdnjs.cloudflare.com/ajax/libs/babel-standalone/6.14.0/babel.min.js'></script> | |
</head> | |
<body> |
This file contains 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 widget = { | |
debug: "on", | |
window: { | |
title: "Sample Konfabulator Widget", | |
name: "main_window", | |
width: 500, | |
height: 500 | |
}, | |
image: { | |
src: "Images/Sun.png", |
This file contains 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
// function | |
const kim = { | |
name: 'Kim', | |
hello: function() { | |
console.log(`hi, ${this.name}`) | |
} | |
} | |
// arrow function | |
const lee = { |
This file contains 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
--> what is this? | |
--> console.log('hi') | |
console.log('hello') | |
<!-- and, what is this? | |
<!-- console.log('hi') |
This file contains 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
<script src='javascript'> | |
<!-- | |
console.log('Hello, script') | |
--> | |
</script> |
OlderNewer