How To Reuse Code in React. Techniques that will help you share… | by Bohdan Balov | Feb, 2022

Strategies that can allow you to share React code in a proper means

A bookstore
Picture by Noémi Macavei-Katócz on Unsplash
const getIsUserOfType = curry((sort, consumer) => consumer.sort === sort);const consumer =  id: '1', sort: 'WRITER' ;
getIsUserOfType('ADMIN', consumer); // false
getIsUserOfType('WRITER', consumer); // true
const getIsUserOfAdminType = getIsUserOfType('ADMIN');
const getIsUserOfWriterType = getIsUserOfType('WRITER');
getIsUserOfAdminType(consumer); // false
getIsUserOfAdminType(consumer); // true

More Posts