Solve the problem of no content (blank screen) in the storybook page of the React project

Check the React version in your current project. If the version is above v17.x , please reduce the version of React to below v17 , because the newly updated v17 version will break the UI to a certain extent.

Specific operation

  1. Open the package.json file in the project root directory, find the react field in dependencies , and change the version to 16.13.1 , as shown in the figure:
    Insert picture description here
  2. Open the console, enter the project root directory, and enter the following command to reinstall React. The yarn command is recommended here, because Yarn will use algorithms to verify the integrity of each installation package before the code is executed.
yarn install

After this command is executed, restart the project and you will see the storybook page.

Finally, I hope that the React team can fix this bug as soon as possible. There is no way to reduce the version.

Reference material: https://github.com/storybookjs/storybook/issues/12408
Note: It may be that this issue is relatively new. I have not solved it for a long time on Baidu and Google. Finally, I found a feedback issue in the GitHub repository of storybook. In my small forum, I found a post that encountered the same problem, and finally found a solution. This is also an inspiration to me. If there are any problems that Baidu and Google can’t find in the future, we can try to go to the official GitHub repository Go find it!

Insert picture description here

Guess you like

Origin blog.csdn.net/qq_43592084/article/details/109391949