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
| <div class = "content"></div> | |
| <script type = "text/babel"> | |
| var CommentBox = React.createClass({ | |
| render: function(){ | |
| return ( | |
| <div className=”commentBox”> | |
| Yo! I’m a comment box. | |
| </div> | |
| ); | |
| } |
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
| var CommentList = React.createClass({ | |
| render: function() { | |
| return ( | |
| <div className="commentList"> | |
| Test Test I'm a CommentList. | |
| </div> | |
| ); | |
| } | |
| }); | |
| var CommentForm = React.createClass({ |
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
| var CommentBox = React.createClass({ | |
| render: function(){ | |
| return ( | |
| <div className="commentBox"> | |
| <h1>Comments</h1> | |
| <CommentList /> | |
| <CommentForm /> | |
| </div> | |
| ); | |
| } |
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
| var Comment = React.createClass({ | |
| render: function(){ | |
| return( | |
| <div className="comment"> | |
| <h2 className="commentAuthor"> | |
| {this.props.author} | |
| </h2> | |
| {this.props.children} | |
| </div> | |
| ); |
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
| var CommentList = React.createClass({ | |
| render: function() { | |
| return ( | |
| <div className="commentList"> | |
| <Comment author="Mr.Tony">This is the best comment app ever.</Comment> | |
| <Comment author="Obamha">Love this thing.</Comment> | |
| </div> | |
| ); | |
| } | |
| }); |
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
| var data = [ | |
| {id:1, author:"Mr.Tony", text:"This is the best comment app ever."}, | |
| {id:2, author:"Obhama", text: "Love this thing."} | |
| ]; | |
| class CommentList extends React.Component{ | |
| render() { | |
| var commentNodes = this.props.data.map(function(comment){ | |
| return ( | |
| <Comment author={comment.author} key = {comment.id}> |
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
| function howVarWorks() | |
| { | |
| //i is also visible here. | |
| for( var i = 0 ; i<10 ;i++) | |
| { | |
| //i is visible everywhere in the function | |
| } | |
| //i is also visible here. | |
| } |
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
| Meteor.startup(()=>{ | |
| let server = Meteor.npmRequire('http').createServer() | |
| let io = Meteor.npmRequire('socket.io')(server) | |
| io.on('connection', (socket)=>{ | |
| socket.on('hello',(data)=>{ | |
| console.log('HELLO BISH') | |
| console.log(data.text) | |
| }) | |
| }) | |
| server.listen(9999,()=>{ |
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
| Template.home.events({ | |
| //some code here.... | |
| socket = io.connect('localhost:9999', {forceNew: true}) | |
| //more code here...... | |
| }) |
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
| export default Class { | |
| constructor(props) { | |
| this.state = { | |
| userRole: 'doctor' | |
| } | |
| } | |
| render(){ | |
| const childrenWithProps = React.Children.map(this.props.children, |
OlderNewer