React boilerplate using cutting edge web technologies
- React (Building the user interface)
- Apollo (Data Management with GraphQL)
- Next.js (Server Side Rendering and Code Splitting)
- styled-components (Styling components)
- Storybook (Quickly creating components in isolation)
- Enzyme (React components testing)
- GraphQL (REST alternative / querying data)
- TypeScript (Type system for JavaScript)
- Jest (Test runner)
- GraphQL Code Generator (Generate TypeScript definitions from GraphQL)
- .storybook : Storybook's configuration
- components : Every React Component that isn't a page
- lib : Reusable utility functions
- node_modules : Packages from npm
- pages : Every component here will be the starting component for a route matching the name of the file
- static : Every static files served for the website (ie. favicon.png)
- config.js : Public config variables (ie. backend baseUrl)
- jest.setup.js : Test Runner configuration
- next.config.js : Next.js configuration (currently making sure TypeScript works with Next.js)
- tsconfig.json : TypeScript configuration
- Create a folder named YourComponentName
- Write your component in a YourComponentName.tsx
- To help you develop your component, create a YourComponentName.stories.tsx.
- Create as many story to cover the important use cases of your new component
Example:
storiesOf('Button', module)
.add('with text', () => <Button onClick={action('clicked')}>Hello Button</Button>)
.add('with some emoji', () => (
<Button onClick={action('clicked')}>
<span role="img" aria-label="so cool">
😀 😎 👍 💯
</span>
</Button>
));
- You can now run :
npm run storybook
- Test your component in a YourComponentName.test.tsx file if needed.
Component directory example:
- /components
- /YourComponentName
- /YourComponentName.tsx
- /YourComponentName.stories.tsx
- /YourComponentName.test.tsx
- /YourComponentName
Storybook driven development is the way to go when building a UI
- Browse the storybook to see if a component already exists and fits your needs
- Quickly understand a component you haven't written
- Build in isolation
- Hot Module Replacement speeds up the development process
- No component duplicates
- Enable TypeScript with Jest
- Integrate Jest with Storybook
- Setup TypeScript properly (@types)
- Make sure TSLint rules are being respected
- Fix current TSLint errors
- Setup nProgress (Loading bar + spinner on page transitions)
- Extension pack for VSCode
- More docs + example on key features
##Useful links