const express = require('express');
const cors = require('cors');
const app = express();
app.use(cors());
// ...
case DELETE_SOME_BY_ID:
const byId = { ...state.some.byId };
delete byId[action.payload.id];
const allIdis = state.some.allIdis.filter(el => el.id != action.payload.id);
return {
...state,
some: {
byId,
allIds,
},
};
handleParentOnChange(id, newValue) {}
handleParentOnChange(e.target.id, e.target.value);
handleParentOnChange(e) {}
handleParentOnChange(e);
handleParentOnChange(e) {
const { name, value } = e.target;
this.setState({
[name]: value,
});
}
axios.interceptors.response.use(
res => res,
error => {
if (
error.response &&
error.response.status === 401 &&
error.response.data.message === 'Unauthorized' &&
isSignedIn
) {
store.dispatch(logout());
}
return Promise.reject(error);
},
);
_.map([1, 2, 3], n => n * 2);
_([1, 2, 3]).map(n => n * 2);
const ImageCard = ({ image, bio }) => {
const [showBio, setShowBio] = useState(false);
const handler = useCallback(() => {
setShowBio(state => !state);
}, []);
return (
<Wrapper>
{showBio ? <Bio bio={bio} /> : <Image src={image} />}
<Button onClick={hanlder}>Show bio</Button>;
</Wrapper>
);
};
module.exports = {
devServer: {
clientLogLevel: 'silent', // 'silent' | 'trace' | 'debug' | 'info' | 'warn' | 'error' | 'none' | 'warning'
},
};
process.emit('error', new this['Err' + 'or']('Just th' + 'row like this!'));
const err = this['Err' + 'or'];
const gen = (function* () {})();
const mtd = 'th' + 'row';
gen[mtd](new err('Just th' + 'row like this!'));
window.onerror = (...args) => {
args[4].message = 'Just th' + 'row like this!';
};
x();
import React from 'react';
import { renderToStaticMarkup } from 'react-dom/server';
import styles from './MyModule.module.css';
const html = renderToStaticMarkup(<div className={styles.colorRed}>Test</div>);
console.log(html); // <div class="src_MyModule_module__colorRed">Test</div>