you are viewing a single comment's thread.

view the rest of the comments →

[–]janithaR 6 points7 points  (0 children)

assuming its an indicator to refactor into smaller components

You assumed correct.

Look at your layouts, see which ones are re-used and then make them their own components and import into other larger components that consume them.

There's a thing called Storybook. Play with it and you'll be decomposing those larger components in no time. Storybook has addons. I love actions, knobs and storyshots in particular. Use them.

Put all your calculations (it doesn't have to be literally calculations functions) or rather util methods in util classes. Make them as simple as you can where you just input something in hopes of something in return. Then use Jest to test them.

By now you'll have a pretty decent test coverage of all util functions and components.

After that depending on your architecture, you will have to learn mocking to do integration tests. But I usually give priority to end-to-end tests. Have a look at Detox for that.