React Hooks , Accessibility, & Some Coding Problems You need To Know
We all have already known about react and React hooks already . But it is not a problem if we recap the things once again right??….
So, What Is React Hooks?
Hooks are a fundamentally simpler way of encapsulating stateful behavior and side effects in user interfaces. They were introduced in React but Nowadays they are being used in various frameworks like Vue, Svelte, and even adapted for general functional JS.
Why use Hooks?
There may be hundreds of reasons to use Hooks we can say but basic reasons are three:
- Huge components that are hard to refactor and test.
- Duplicated logic between different components and lifecycle methods.
- Complex patterns like render props and higher-order components.
Do They Make React Application Bloated?
Hooks let one always use functions instead of having to constantly switch between functions, classes, higher-order components, and render props. In terms of the implementation size, the Hooks support increases React only by ~1.5kB (min+gzip). While using this isn’t much, it’s also likely that adopting Hooks could reduce ones bundle size because code using Hooks tends to minify better than equivalent code using classes.
What Really Are Hooks?
Hooks let one to use React features (like state) from a function by doing a single function call. React provides some built-in Hooks exposing the “building blocks” of React: state, lifecycle, and context.
Accessibility
Web accessibility (also referred to as a11y) is the design and creation of websites that can be used by everyone. Accessibility support is necessary to allow assistive technology to interpret web pages.
React fully supports building accessible websites, often by using standard HTML techniques.
Standards and Guidelines
WCAG
The Web Content Accessibility Guidelines provides guidelines for creating accessible web sites.
The following WCAG checklists provide an overview:
Some Basic Problem Solving
Factorial of a number:
- Factorialize a Number With Recursion
2. Factorialize a Number with a WHILE loop
3. Factorialize a Number with a FOR loop
Fibonacci:
- For loop
2. Recursive way