Library with name storybook lets you handy organize pretty functional showroom for all implemented components in your system.
Apart of ability render component, you can interact with added components: different events, variations, custom params... and manipulate them right through interface!
importReactfrom'react';import{ configure, addDecorator }from'@storybook/react';import{TestProvider}from'../src/utils/tests';import{ store }from'../src/redux/store';const req = require.context('../src',true,/\.stories\.tsx$/);functionloadStories(){ req.keys().forEach(req);}// Test provider contains all necessary react contexts for proper application work, such as redux context, @mui/theme provider, and so onaddDecorator((S)=>(<TestProvider store={store}><S/></TestProvider>));configure(loadStories, module);
Create file .storybook/main.js with content:
const path =require('path');module.exports={addons:['@storybook/preset-create-react-app'],core:{builder:'webpack5',},// feel free to modify webpack config here as wellwebpackFinal:async(config)=>{ config.module.rules.push({test:/\.mjs$/,include:/node_modules/,type:'javascript/auto',});// my custom alias for pretty-path module resolution. ~ sign points to root of src folder config.resolve.alias['~']= path.resolve(__dirname,'../src');return config;},};
As a developer, I needed to trigger a React modal from a SharePoint Ribbon button, bridging classic JS and modern React. This post explains the challenge, the solution using the global window object, and how I made React state accessible from outside the bundle.
A practical guide to setting up import path aliases in Create React App projects using CRACO or react-app-rewired, with step-by-step configuration examples.
Open for contract collaboration
I am available for contract-based collaboration. If you have an interesting project idea, schedule a call via Calendly.