someFunction = () => {
const {sms} = this.state;
sms.disabled = true;
this.setState({sms});
}
someFunction = () => {
this.setState({sms: {...this.state.sms, disabled: true}});
}
someFunction = () => {
this.setState(prevState=>({sms: {...prevState.sms, disabled: true}}));
}
npm run eject
, которая добавит все зависимости и конфиги в проект. Отменить нельзяnpm i --save-dev stylus stylus-loader
{
test: /\.styl$/,
use: [
require.resolve('style-loader'),
{
loader: 'css-loader',
options: {
// можно удалить, если не нужны css модули
modules: true,
localIdentName: '[name]__[local]--[hash:base64:5]',
camelCase: true,
sourceMap: true,
},
}, {
// postcss-loader и autoprefixer уже есть в create-react-app
loader: 'postcss-loader',
options: {
plugins: () => [
autoprefixer({ browsers: ['>= 10%', 'last 2 versions'] })
],
sourceMap: true,
},
}, {
loader: 'stylus-loader',
options: {
sourceMap: true,
},
}],
},
{
test: /\.(styl|css)$/,
loader: ExtractTextPlugin.extract(
Object.assign(
{
fallback: {
loader: require.resolve('style-loader'),
options: {
hmr: false,
},
},
use: [
{
loader: require.resolve('css-loader'),
options: {
importLoaders: 1,
minimize: true,
sourceMap: shouldUseSourceMap,
},
},
{
loader: require.resolve('postcss-loader'),
options: {
// Necessary for external CSS imports to work
// https://github.com/facebookincubator/create-react-app/issues/2677
ident: 'postcss',
plugins: () => [
require('postcss-flexbugs-fixes'),
autoprefixer({
browsers: [
'>1%',
'last 4 versions',
'Firefox ESR',
'not ie < 9', // React doesn't support IE8 anyway
],
flexbox: 'no-2009',
}),
cssMQPacker(),
],
},
},
{
loader: require.resolve('stylus-loader'),
options: {
minimize: true
}
}
],
},
extractTextPluginOptions
)
),
// Note: this won't work without `new ExtractTextPlugin()` in `plugins`.
},
response.json().then(function(data)
.then(response => {
console.log("Эта строка в консоль уже не выводится");
this.setState is not a function