page work error when use react-router
Can you provide more details? Are you using preact-compat to load react-router? What version of the react-router library are you using?
yes , i am using preact-compat .
"preact-compat": "3.16.0",
"react-router": "3.0.5"
Please help.
hey @AnkitJainAJ, I'm getting the same issue with react-router. Digging into the source code, it seems that react-router uses create-react-class, which will need to be aliased to the preact-compat version with webpack, browserify or babel, e.g:
// webpack.config.js
module.exports = {
// ...
alias: {
'react': 'preact-compat',
'react-dom': 'preact-compat',
'create-react-class': 'preact-compat/lib/create-react-class'
}
}
I hope this helps!
Hi @e-r-w,
It worked , thanks for the help.
Closing since @e-r-w found the issue - hopefully anyone searching for it finds this one :)
Most helpful comment
hey @AnkitJainAJ, I'm getting the same issue with
react-router. Digging into the source code, it seems thatreact-routerusescreate-react-class, which will need to be aliased to the preact-compat version with webpack, browserify or babel, e.g:I hope this helps!