Skip to content

Instantly share code, notes, and snippets.

@cem2ran
Created December 28, 2015 01:10
Show Gist options
  • Star 22 You must be signed in to star a gist
  • Fork 4 You must be signed in to fork a gist
  • Save cem2ran/9be3dd3499566302d5ae to your computer and use it in GitHub Desktop.
Save cem2ran/9be3dd3499566302d5ae to your computer and use it in GitHub Desktop.
React Getting Started - How it should be!
import React from 'react'
import ReactDOM from 'react-dom'
const Hello = ({name}) => <h1>Hello {name}!</h1>
ReactDOM.render(
<Hello name={"vjeux"}/>,
document.body.appendChild(document.createElement("div"))
)
<!DOCTYPE html>
<script src="https://jspm.io/system@0.19.js"></script>
<script>
System.config({
transpiler: 'babel', // or 'traceur' or 'typescript'
babelOptions: {} // or traceurOptions or typescriptOptions
});
System.import('./main.js');
</script>
@frostney
Copy link

This is very convenient, thank you very much. Out of curiosity: Is there a way to use CommonJS here instead of ES2015 modules?

@cem2ran
Copy link
Author

cem2ran commented Jan 3, 2016

@frostney, that shouldn't be a problem.

@kolodny: nice! I went a little further: https://react-play.surge.sh

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment