// flutter
setState(() {
name = newValue
})
// react
this.setState({
{ | |
"env": { | |
"browser": true, | |
"es6": true, | |
"jest": true | |
}, | |
"settings": { | |
"react": { | |
"version": "detect" | |
} |
const removeAcentos = str => str.normalize('NFD').replace(/[\u0300-\u036f]/g, "") |
const [primaryAddress, setPrimaryAddress] = useState('') | |
const [secondaryAddress, setSecondaryAddress] = useState('') | |
useEffect(() => { | |
setPrimaryAddress(props.priAddress) | |
}, [props.priAddress]) | |
useEffect(() => { | |
setSecondaryAddress(props.secAddress) | |
}, [props.secAddress]) |
import React from "react"; | |
import { useFormik } from "formik"; | |
const initialValues = { | |
name: "", | |
email: "", | |
address: { | |
street: "", | |
number: "", | |
city: "" |
// {...} | |
<div> | |
<form> | |
<input placeholder="Name" {...formik.getFieldProps("name")} /> | |
<br /> | |
<input placeholder="Email" {...formik.getFieldProps("email")} /> | |
<br /> | |
<input placeholder="Password" {...formik.getFieldProps("password")} /> | |
<br /> | |
<input |
Number(5).toLocaleString('pt-BR', {style: 'currency',currency: 'BRL'}) |
// flutter
setState(() {
name = newValue
})
// react
this.setState({
class Container extends StatelessWidget { | |
@override | |
Widget build(BuildContext context) { | |
return MyButton(title: 'Titulo do button'); | |
} | |
} | |
class MyButton extends StatelessWidget { | |
String title; |
{ | |
'consistent-return': 'off', | |
'no-shadow': 'off', | |
'global-require': 'off', | |
'react/require-default-props': 'off', | |
'react/react-in-jsx-scope': 'off', | |
'react/jsx-filename-extension': 'off', | |
'react/prop-types': 'off', | |
'react/jsx-props-no-spreading': 'off', |
// de: | |
const MyInput = ({ onChange, value }) => ( | |
<Container> | |
<Label htmlFor="campoId"> | |
Campo X | |
<Input id="campoId" onChange={onChange} value={value} /> | |
</Label> | |
</Container> | |
) | |
// para: |