react-hookz / web

React hooks done right, for browser and SSR.
https://react-hookz.github.io/web/
MIT License
1.93k stars 94 forks source link

Link to source code on docs. #1201

Open wirekang opened 1 year ago

wirekang commented 1 year ago

New Features

What is the new or updated feature that you are suggesting?

It would be great if reader can show the original source code of the hook.

Why should this feature be included?

It helps to understand how things work.

ArttuOll commented 1 year ago

We're currently planning to move to a whole new docs system. We'll make sure to consider this when the new docs start taking shape!

fredericrous commented 3 months ago

storybook is a solid choice in 2024. not that I'm a huge fan but it does the job and still gets regularly updated. note that sometimes for the show code to work, I need to define an empty object as an argument to the export function

before

https://github.com/react-hookz/web/blob/579a445fcc9f4f4bb5b9d5e670b2e57448b4ee50/src/useResizeObserver/__docs__/example.stories.tsx#L9

after

export function Example({}) {

I know that's weird 😆

xobotyi commented 3 months ago

Yet still they force everyone to rewrite all docs every other major release.

fredericrous commented 3 months ago

the alternatives are limited tho?

I loved react-cosmos.. but my experience with it was that it was a pain to make it work on projects and it gets updated rather slowly.

I tried ladle, I don't like its interface nor the way it shows code, and there's no place for written doc.

An alternative I haven't tried is Docusaurus, it's from facebook after all.

In the mid-time I'm happy using storybook v8. I tried not to use it but in the end it does the job and is customizable, plus I only upgrade it when React gets updated and it comes with an upgrade command powered by codemod