Skip to content

Instantly share code, notes, and snippets.

View gilbertoquinteroA's full-sized avatar

simon gilbertoquinteroA

View GitHub Profile
root@me:/home/memee/Desktop/test/ReactJS/reactApp/site# npm install babel-core --save
npm ERR! file /home/memee/Desktop/test/ReactJS/reactApp/site/package.json
npm ERR! code EJSONPARSE
npm ERR! JSON.parse Failed to parse json
npm ERR! JSON.parse Unexpected string in JSON at position 472 while parsing '{
npm ERR! JSON.parse "name": "site",
npm ERR! JSON.parse "version": "1.0.0"'
npm ERR! JSON.parse Failed to parse package.json data.
npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.
var Board = React.createClass({
render: function() {
var className = "board";
if (this.props.selected) {
className += " selected";
}
return (
<div className={className}>
{this.props.index + 1}
</div>
// This one's a little tricky! Comments inline.
//first components
var ChildComponent = React.createClass({
render: function() {
return (
<div>
<div className="prompt">Add a click handler to this button so that when clicked, performMagic is called in the parent component.</div>
{/* Props can be any valid JavaScript expression, including functions. When this button is clicked, it calls the given function, which happens to be performMagic in the parent component. */}
// There are multiple ways to implement this component. This is one.
var VacancySign = React.createClass({
render: function() {
var text;
if (this.props.hasvacancy) {
text = 'Vacancy';
} else {
text = 'No Vacancy';
}
return <div>{text}</div>;
#include <linux/init.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <asm/uaccess.h>
MODULE_LICENSE(“GPL”);
MODULE_AUTHOR(“Robert W. Oliver II”);
MODULE_DESCRIPTION(“A simple example Linux module.”);
MODULE_VERSION(“0.01”);
#define DEVICE_NAME “lkm_example”
ReactDOM.render(
<App cat="miffy"></App>,
document.getElementById('app')
)
const App = () => {
let cat = {name: "Fluffy"};
return <Cat name={cat} />
}
const Cats = (props) =>
<ul>
{
props.cats.map((cat) =>
<li id={cat.id}>
{cat.name}
</li>
)
}
</ul>
const cats = [
{id: 1, name: "Sherlock"},
{id: 2, name: "Watson"}
]
<button onClick={props.saveEveryone}>Save The World</button>