Skip to content

Instantly share code, notes, and snippets.

View akexorcist's full-sized avatar
🔥

Akexorcist akexorcist

🔥
View GitHub Profile
@akexorcist
akexorcist / axios-request-body.json
Created January 3, 2018 16:37
Request Body from Axios with x-www-form-urlencoded content type
{ '{"name":"Akexorcist","age":"28","position":"Android Developer","description":"birthdate': '25-12-1989',
favourite: 'coding coding and coding',
company: 'Nextzy Technologies',
website: 'http://www.akexorcist.com/","awesome":true}' }
@akexorcist
akexorcist / index.js
Created January 3, 2018 16:53
Convert to query string with query-string library before requesting
...
const queryString = require('query-string')
...
axios.post(url, queryString.stringify(requestBody), config)
.then((result) => {
// Do somthing
})
@akexorcist
akexorcist / axios-request-body.json
Created January 3, 2018 16:55
Converted request body from Axios with x-www-form-urlencoded content type
{
"age": "28",
"awesome": "true",
"description": "birthdate=25-12-1989&favourite=coding%20coding%20and%20coding&company=Nextzy%20Technologies&website=http://www.akexorcist.com/",
"name": "Akexorcist",
"position": "Android Developer"
}
import React, { Component } from 'react'
...
class ChildComponent extends Component {
...
render() {
return (
<React.Fragment>
...
import React, { Component } from 'react'
import ChildComponent from './ChildComponent'
...
class ParentComponent extends Component {
constructor(props) {
super(props)
this.state = {
buttonVisibility: false
};
import React, { Component } from 'react'
...
class ChildComponent extends Component {
...
onConfirmClick = () => {
const order = ...
this.props.confirm(order)
}
import React, { Component } from 'react'
import ChildComponent from './ChildComponent'
...
class ParentComponent extends Component {
...
onConfirm(order) {
// Do something
}
...
onConfirmClick = () => {
if (this.props.confirm) {
const order = ...
this.props.confirm(order)
}
}
...
import React, { Component } from 'react'
...
class FirstChildComponent extends Component {
...
onConfirmClick = () => {
const order = ...
if (this.props.confirm) {
this.props.confirm(order)
import React, { Component } from 'react'
import FirstChildComponent from './FirstChildComponent'
import SecondChildComponent from './SecondChildComponent'
...
class ParentComponent extends Component {
constructor(props) {
super(props)
this.state = {
isOrderConfirm: false