Skip to content

Instantly share code, notes, and snippets.

View labidiaymen's full-sized avatar

Aymen labidiaymen

View GitHub Profile
class MyComponent extends HTMLElement {
function connectedCallback() {
this.innerHTML = "<h1>Hello world</h1>";
}}
customElements.define('my-component', MyComponent);
function MainForm() {
const pageTitle = useFormInput('');
//as simple as that
useEffect(() => {
document.title = pageTitle.value;
});
return (
constructor() {
super();
this.state = {
pageTitle: 'React Hooks'
};
}
handleTitleChange(e) {
this.setState({
pageTitle: e.target.value
function LoginForm() {
const name = useFormInput('');
const lastName = useFormInput('');
return (
<div>
<div className="form-control">
<TextField label="Name" {...name} />
</div>
// state generator
function useFormInput(init_value) {
const [value, setValue] = useState(init_value);
function handleChange(e) {
setValue(e.target.value);
}
return {
value,
onChange: handleChange
}
constructor() {
super();
this.state = {
name: '',
lastName: '',
pageTitle: 'React Hooks'
};
}
handleNameChange(e) {
build_job:
image: runmymind/docker-android-sdk:ubuntu-standalone
variables:
NODE_VERSION: 8.9.4
stage: build
only:
- master
script:
- git submodule update --init --recursive
- wget -q http://nodejs.org/dist/v${NODE_VERSION}/node-v${NODE_VERSION}-linux-x64.tar.gz
public cs: CoursesService,
public af: AngularFire,
public router: Router
<?php ?>z