Last Message ID: 89569
Andrew M. Webb on Twitter |
---|
type Props = { | |
}; | |
const FormUseFormik = (props: Props) => { | |
const { enqueueSnackbar } = useSnackbar(); | |
const onSubmit = (values) => { | |
enqueueSnackbar(`submit: ${JSON.stringify(values)}`, { | |
preventDuplicate: true, | |
persist: false, | |
}); |
const winston = jest.genMockFromModule('winston'); | |
const format = jest.fn(); | |
format.json = jest.fn(); | |
const Winston = { | |
...winston, | |
format, | |
transports: { | |
File: jest.fn(), |
Last Message ID: 89569
Andrew M. Webb on Twitter |
---|
import { useEffect, useRef } from 'react'; | |
import { useHistory } from 'react-router-dom'; | |
export const usePrompt = (when: boolean, message: string = 'Are you sure you want to quit without saving your changes?') => { | |
const history = useHistory(); | |
const self = useRef(null); | |
const onWindowOrTabClose = event => { | |
if (!when) { |
const MyContext = createContext(); | |
function reducer(state, action) { | |
switch (action.type) { | |
case "COUNT_REQUEST": | |
return { | |
...state, | |
loading: true, | |
err: undefined | |
}; |
# If you come from bash you might have to change your $PATH. | |
# export PATH=$HOME/bin:/usr/local/bin:$PATH | |
export ANDROID_HOME=~/Android/Sdk | |
export PATH="$PATH:$ANDROID_HOME/tools" | |
export PATH="$PATH:$ANDROID_HOME/platform-tools" | |
# Path to your oh-my-zsh installation. | |
export ZSH="/Users/diegofernandes/.oh-my-zsh" | |
export PATH="$PATH:/usr/local/bin" |
import React, { useState, useContext, useRef } from 'react' | |
import { DatePicker } from 'material-ui-pickers' | |
import { MuiPickersContext } from 'material-ui-pickers' | |
export default function DateMultiPicker({ | |
value, | |
onChange, | |
labelFunc, | |
format, | |
emptyLabel, |
import * as React from 'react'; | |
import { withRouter } from 'react-router-dom'; | |
import { isLoggedIn } from '../../security/authentication'; | |
import routeTo from '../utils/routeTo'; | |
const authenticatedMiddleware = Component => { | |
class AuthenticatedMiddleware extends React.PureComponent { | |
componentDidMount() { | |
this.redirectIfNotAuthenticated(); |
Props são atributos que podem ser passados para componentes (não mude eles dentro do component que vc está usando)
Pros are attributes that can be passed to components (don't change them into the component which is using them)
A melhor forma de manipular as props que foram passadas e outros atributos do seu component
from pyspark.sql import functions as F | |
from pyspark.sql.types import DoubleType | |
import pandas as pd | |
from sklearn.externals import joblib | |
def make_predictions(sc, df, feature_cols, model_path): | |
""" | |
Make predictions. | |