componentWillMount causes React.StrictMode to error
Closed this issue · 8 comments
As per https://reactjs.org/docs/strict-mode.html#identifying-unsafe-lifecycles, I believe the following code is causing React apps using React.StrictMode
to error, saying that this should be converted to the safer componentDidMount
:
react-measure/src/with-content-rect.js
Lines 31 to 34 in 350c5ce
I'm not familiar with this library, but it seems like these could perhaps live in a constructor
function?
If you think I'm on the right track, I'm happy to try a PR.
Yup! These should work fine in a constructor method. If you'd like to create a PR, I can review it and get it released. Thank you for filing an issue and being willing to make a PR! 🙏
Actually, you should be able to just add these as properties on the class, even easier ✨.
Rock on. I'll see if I can get something up tonight
@souporserious are you sure the README is up to date for getting set up? Couple of things:
- there seems to be a
yarn.lock
file but nopackage-lock.json
, implying that I should useyarn
and notnpm
to do dev - running
yarn run dev
gives a webpack error saying:so then I add that but get another error saying:The CLI moved into a separate package: webpack-cli Please install 'webpack-cli' in addition to webpack itself to use the CLI -> When using npm: npm i -D webpack-cli -> When using yarn: yarn add -D webpack-cli
yarn run v1.12.3 $ webpack-dev-server --inline --hot --progress --colors --host 0.0.0.0 --devtool eval /path/to/project/react-measure/node_modules/webpack-cli/bin/convert-argv.js:156 const webpackConfigurationValidationErrors = validateSchema( ^ TypeError: validateSchema is not a function
Any help for getting set up would be appreciated!
You can probably reproduce this if you remove your node_modules/
folder and install from scratch
@souporserious Do you yet know when your next release will be?
Apologies for the delay! I was on vacation and then needed to finish the PR that cleaned up the build system. It's published under 2.2.1
now. Thanks for the help! 🙏
Thank you! Hope your vacation was excellent