Releases: grlt-hub/react-slots
Releases · grlt-hub/react-slots
Release list
4.0.0-beta.1
v4.0.0-beta.1 chore: release v4.0.0-beta.1
4.0.0-beta.0
v4.0.0-beta.0 chore: release v4.0.0-beta.0
3.1.0
Added
- Now
whensupports anyUnitfrom Effector. (#11)
Changed
Componentreturn type fromReact.JSX.ElementtoReact.ReactNode. (#10)
Big thanks to @TheCoffeeFox for spotting the type improvements!
3.0.1
3.0.0
Changed
-
BREAKING:
componentfield renamed toComponent(capital C) to enable React hooks usage in inline components without ESLint warnings -
BREAKING: API structure changed to target-first approach
Before (v2):
slotsApi.insert.into.Description({ component: MyComponent });
After (v3):
slotsApi.Description.insert({ Component: MyComponent });
Benefits:
- Discoverability: Type
slotsApi.to see all available slots, thenslotsApi.[SlotName].to see all actions for that slot - Logical grouping: All methods for a specific slot are in one place
- Discoverability: Type
Added
clearmethod to clear all components from a slot
Migration from v2 to v3
- Replace
slotsApi.insert.into.[SlotName]withslotsApi.[SlotName].insert - Replace
component:withComponent:in all insert calls
Example:
// v2
slotsApi.insert.into.Header({ component: MyComponent });
// v3
slotsApi.Header.insert({ Component: MyComponent });2.0.0
Changed
- renamed
fntomapProps
Added
whenparameter to defer slot insertion until specified Effector events fire
const userLoaded = createEvent<{ id: number }>();
slotsApi.insert.into.Header({
when: userLoaded, // Wait for event
mapProps: (slotProps, whenPayload) => ({ userId: whenPayload.id }),
component: (props) => <UserWidget id={props.userId} />,
});
userLoaded({ id: 123 }); // Component inserted now