abbassizied / crud-rtk-react-with-ts-app

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

README

Keeping Server-Only Code out of Client Components (Poisoning)

  • The "server only" package: use this package to mark modules that contain server-only code and to receive a build-time error explaining that this module can only be used on the server.
npm install server-only // To prevent unintended client usage of server code 

// Then
import 'server-only'
  • The "client only" package: use this package to mark modules that contain client-only code and to receive a build-time error explaining that this module can only be used on the client.
npm install client-only // To prevent unintended server usage of client code 

// Then
import 'client-only'

Suspense

import { Suspense } from 'react'

<Suspense fallback={<p>Loading ...</p>}>
 // *******        
</Suspense>

Uncontrolled vs. Controlled

  • The component can be controlled or uncontrolled.
    • A component is controlled when it's managed by its parent using props.
    • A component is uncontrolled when it's managed by its own local state.

🌈 Tech Stack

  • TypeScript
  • React
  • Jest with React Testing Library for the unit tests
  • Cypress for the end-to-end tests

πŸ”€ Related information

Feel free to check it out and star the repo! πŸŒŸπŸ˜ŠπŸ™Œ

About


Languages

Language:TypeScript 98.5%Language:HTML 1.1%Language:JavaScript 0.4%