Skip to content

Instantly share code, notes, and snippets.

View inPhoenix's full-sized avatar
🏠
Working from home

inPhoenix inPhoenix

🏠
Working from home
View GitHub Profile
@staltz
staltz / introrx.md
Last active July 2, 2024 03:45
The introduction to Reactive Programming you've been missing
@Qt-dev
Qt-dev / data.js
Last active July 12, 2018 21:06
ReactJS - How to make a simple navbar menu
var data = [
{
"text": "Link 1",
"url": "#"
},
{
"text": "Link 2",
"url": "#"
},
{
var Col = require('react-bootstrap/lib/Col')
var PageHeader = require('react-bootstrap/lib/PageHeader')
var React = require('react')
var Row = require('react-bootstrap/lib/Row')
var {connect} = require('react-redux')
var {reduxForm} = require('redux-form')
var DateInput = require('./DateInput')
var FormField = require('./FormField')
var LoadingButton = require('./LoadingButton')
@tejacques
tejacques / HOCBaseRender.tsx
Last active May 2, 2022 13:05
React Higher Order Components in TypeScript
import * as React from 'react';
import { Component } from 'react';
export default function HOCBaseRender<Props, State, ComponentState>(
Comp: new() => Component<Props & State, ComponentState>) {
return class HOCBase extends Component<Props, State> {
render() {
return <Comp {...this.props} {...this.state}/>;
}
}
@sbalay
sbalay / FormNormalizeAndFormatValues.js
Last active July 11, 2022 05:02
Redux-form example with normalize and format
import React from 'react';
import { reduxForm, Field } from 'redux-form';
import { ScrollView, Text, TouchableOpacity } from 'react-native';
import moment from 'moment';
import MyTextInput from './MyTextInput';
/**
* Automatically adds the dashes required by the specified phone format and limits the input to ten characters
*/
@liorocks
liorocks / jsconfig.md
Last active May 25, 2023 13:47
jsconfig.json

jsconfig.json

{
  "compilerOptions": {
    "baseUrl": "./src",
    "target": "ES6",
    "jsx": "preserve",
    "allowSyntheticDefaultImports": true
  },
 "exclude": ["build", "node_modules"]
@inPhoenix
inPhoenix / AutoBindArrow
Last active December 1, 2018 11:01
React ES6 stage2 autobinding Arrow Function with parameters
// Example using create-react-app.
// For scratch configurations, add babel-plugin-transform-class-properties.
// More info: https://babeljs.io/docs/plugins/transform-class-properties/
import React from 'react'
class Example extends React.Component {
example = (param) => () => {
console.log('Hello ', param)
}
@otakustay
otakustay / hoc.jsx
Last active February 4, 2021 09:22
Convert HOC to Hook
// HOC版本
const withDelayHint = (loadingPropName, delay) => ComponentIn => class extends Component {
state = {
timer: null,
isDelayed: false
};
tryStartTimer = () => {
clearTimeout(this.state.timer);