1.0.1 • Published 2 years ago
@notprometey/react-slots v1.0.1
React slots
slots for react app. You can find a demo here
Install
npm install --save @notprometey/react-slots
Usage
import React from 'react'
import { Slot, withSlots } from '@notprometey/react-slots';
const Modal = () => {
return (
<div>
<Slot>default content of default slot</Slot>
<Slot name='test'>default content of test slot</Slot>
</div>
);
};
export default withSlots(Modal);
import React from 'react'
import { Template } from '@notprometey/react-slots';
import Modal from './components/Modal';
const App = () => {
return (
<Modal>
<span>content to default slot</span>
<Template slot='test'>content to test slot</Template>
</Modal>
);
};
License
MIT © notprometey