Skip to content

Instantly share code, notes, and snippets.

@chrismatthieu
Created February 20, 2020 19:59
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save chrismatthieu/a075f186eecc8740fe76d33520187174 to your computer and use it in GitHub Desktop.
//
import React from 'react';
import { View, Button } from 'magic-script-components';
export default class MyApp extends React.Component {
constructor (props) {
super(props);
this.state = {
message: props.message
};
}
render () {
return (
<View name="main-view">
<button
enabled=true
textColor='red'
textSize=0.08
roundness=0.5
width=0.0
height=0.0
onClick=updateBlink1('red')
>Red</button>
</View>
);
}
}
function updateBlink1(color){
fetch("http://192.168.0.10:3000/" + color)
}
@grozdanov
Copy link

grozdanov commented Feb 20, 2020

import React from 'react';
import { View, Button } from 'magic-script-components';

export default class MyApp extends React.Component {
  constructor (props) {
    super(props);

    this.state = {
      message: props.message
    };

   this.updateBlink1 = this.updateBlick1.bind(this);
  }

  updateBlink1(color) {
    fetch("http://192.168.0.10:3000/" + color)
  }

  render () {
    return (
      <View name="main-view">
        <button
           enabled={true}
           textColor='red'
           textSize={0.08}
           roundness={0.5}
            width={0.0}
            height={0.0}
           onClick={ ()=> this.updateBlink1('red') }
        >Red</button>
      </View>
    );
  }
}

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