MASMOVIL TECHNOLOGY
#frontend-general | #tech-chat
import React from 'react'
interface HeaderProps {
name: string;
color: string;
}
type OtherHeaderProps = {
name: string;
color: string;
}
// Notice here we're using the function declaration with the interface Props
function Header({ name, color }: HeaderProps): React.ReactNode {
return <h1>My Website Heading</h1>
}
// Notice here we're using the function expression with the type OtherProps
const OtherHeader: React.FC<OtherHeaderProps> = ({ name, color }) =>
<h1>My Website Heading</h1>
React components
import React from 'react';
type ButtonProps = {
/** the background color of the button */
color: string;
/** the text to show inside the button */
text: string;
}
type ContainerProps = ButtonProps & {
/** the height of the container (value used with 'px') */
height: number;
}
const Container: React.FC<ContainerProps> = ({ color, height, width, text }) => {
return <div style={{ backgroundColor: color, height: `${height}px` }}>{text}</div>
}
Typed props
import React from 'react';
interface ButtonProps {
/** the background color of the button */
color: string;
/** the text to show inside the button */
text: string;
}
interface ContainerProps extends ButtonProps {
/** the height of the container (value used with 'px') */
height: number;
}
const Container: React.FC<ContainerProps> = ({ color, height, width, text }) => {
return <div style={{ backgroundColor: color, height: `${height}px` }}>{text}</div>
}
Typed props 2
import React from 'react'
const MyInput = () => {
const [value, setValue] = React.useState('')
// The event type is a "ChangeEvent"
// We pass in "HTMLInputElement" to the input
function onChange(e: React.ChangeEvent<HTMLInputElement>) {
setValue(e.target.value)
}
return <input value={value} onChange={onChange} id="input-example"/>
}
Synthetic events
NGRX
Redux- Observable
NGRX
Deterministic
Reproducible
Incremental
Tooling
Versioning
Deployment
Code complexity will always increase.
Only working on it actively will help to reduce it.
me, just right now
Predictable
Consistent
Reactive
Shareable
If we merge this PR can be deployed anytime to prod?
Preserve query params as default
Why?
Who creates/need it should remove it after
#frontend-general | #tech-chat