CodeQuestic / OpenPrep

Comprehensive collection of resources for various programming languages. It includes code samples, best practices, and reference materials to help developers of all levels enhance their skills and knowledge in multiple languages.
https://openprep.pages.dev
MIT License
4 stars 7 forks source link

[Hacktoberfest]: Add content for React - Hooks in React #17

Closed rakshixh closed 3 weeks ago

rakshixh commented 1 month ago

πŸ“ Issue Description

Add the following content for Hooks in React under REACT

  1. Introduction to Hooks: (What are Hooks, Rules of Hooks)
  2. Basic Hooks: [useState (Managing State), useEffect (Handling Side Effects)]
  3. Additional Hooks: [useContext (Context API for Global State), useRef (Referencing DOM Elements), useReducer (State Logic for Complex State), useMemo (Memoization to Avoid Unnecessary Re-renders), useCallback (Memoizing Functions)
  4. Custom Hooks: (Creating Custom Hooks, When and Why to Use Custom Hooks)

File you will be working on: src\content\docs\react\hooks.mdx

🎯 Expected Outcome

The expected outcome is to add a well-documented and informative section under React that covers the following topics:

The content should be written clearly, with examples where necessary, and provide value for developers who are new to hooks or looking to deepen their understanding of React Hooks. Please don't make use of the AIs.

πŸ”§ Solution Guidance (Optional)

πŸ“‹ Steps to Reproduce

πŸ’‘ Additional Context (Optional)

πŸŽƒ Hacktoberfest Participation

βœ”οΈ This issue is tagged for Hacktoberfest. βœ”οΈ PR should reference this issue and adhere to contribution guidelines.

πŸ‘₯ Contributors

If you are working on this issue, please comment below to let us know. Feel free to ask any questions! Don't forget to go through the Code of Conduct and follow the CONTRIBUTING guidelines.


Thank you for contributing to Hacktoberfest and helping improve this project!

Nitheesh-2003 commented 1 month ago

Hi there,

Can I work on this ?

Nitheesh-2003 commented 1 month ago

Hi @rakshixh,

Whether I need to add Astro components in all the examples ? Because certain examples are somewhat small. So, if I add Astro Components as well it will make it complex. Can you clear my doubt.

rakshixh commented 1 month ago

Hey @Nitheesh-2003

Yeah because it will maintain the ui across the site. Even if it is small code snippet! All you need to do is import that component from astro in mdx file then dump the code file in txt format inside the 'codes/{your issue folder}/{code snippet file}.txt'

Please note that we have already created folder so that you can dump n number of code snippet txt files inside that folder! Please check the folder structure! If you have any further questions please ask!

rakshixh commented 1 month ago

But in case of hooks if you are displaying only const [file , setFile] = useState();

This you can use md format no need to use the astro component!

But if the snippet is more than 2 lines including brackets etc then please use astro components!

Nitheesh-2003 commented 4 weeks ago

One more clarification, Actual code will be in the code directory. Then whether I need to mention something in place where the example needs to be placed in the mdx file

rakshixh commented 4 weeks ago

One more clarification,

Actual code will be in the code directory. Then whether I need to mention something in place where the example needs to be placed in the mdx file

Actual code will be inside the Codes/{file-folderName}/

Please nite that codes directory will be under the main dropdown on which you are working for example: if your working on React then path will be React/Codes/{file-folderName}/

You no need to specify the path in mdx!

But to display the code in mdx file you need to import that code file into mdx. You can refer astro's code component to know how to display code!

Nitheesh-2003 commented 4 weeks ago

Hi @rakshixh,

I have created the PR. Can you please review it and confirm. Thanks