Route path="xxx" component={MyPage}
на Route path="xxx" element={<MyPage />}
) webpack-dev-server doesn't write any output files after compiling. Instead, it keeps bundle files in memory and serves them as if they were real files mounted at the server's root path. If your page expects to find the bundle files on a different path, you can change this with the devMiddleware.publicPath option in the dev server's configuration.
{ 0: string, 1: string, 2: string, 3: string, 45: string }
, но никак не { [key: number]: string }
, который ожидали бы.useState<keyof typeof wwCodes>
type WwCodes = Record<number, string | undefined>
const wwCodes: WwCodes = ...
IMAGE_INLINE_SIZE_LIMIT
через переменные окружения.// "url" loader works like "file" loader except that it embeds assets
// smaller than specified limit in bytes as data URLs to avoid requests.
// A missing `test` is equivalent to a match.
{
test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/],
type: 'asset',
parser: {
dataUrlCondition: {
maxSize: imageInlineSizeLimit,
},
},
},
interface TodoItem {
id: number
subtitle: string
important: boolean
done: boolean
}
const generalToggle = (arr: TodoItem[], id: number, propertyName: keyof TodoItem) => {
const idx = arr.findIndex((item) => item.id === id);
const oldItem = arr[idx];
const value = !oldItem[propertyName];
const item = {...arr[idx], [propertyName]: value};
return [
...arr.slice(0, idx),
item,
...arr.slice(idx + 1)
];
};
function dataPage() {
fetch('example.com')
.then(response => response.json())
.then(data => {
const promises = data.URLs.map(url => fetch(url).then(r => r.json()))
return Promise.all(promises).then((arr) => {
data.arr = arr;
return data;
})
})
.then((data) => {
setState(prevState => {
return (
{
...prevState,
data // вероятно тут спред нужен по логике
}
)
})
})
}
css={`класс`}
выглядит, как emotion css prop.