Skip to content
Discussion options

You must be logged in to vote

Approach 1:

  1. Create a base component for storybook stories that do not use register/control method.
  2. Create a wrapper having your base component as child, use Controller, register, control with this.
  3. In the parent component, call the wrapper with register to have RHF work with storybook.

BaseComponent (call this in storybook) -> parent (WrapperComponent) -> parent (Component where you wish to use baseComponent)

Approach 2: If you wish to use register with storybook.

On code level:
BaseComponent

import React from 'react'
import { TextField } from '@material-ui/core'
import { makeStyles } from '@material-ui/core/styles'
import constants from '../../constants/storyBookConstants'
import color…

Replies: 5 comments 4 replies

Comment options

You must be logged in to vote
2 replies
@Maximilon
Comment options

@Moshyfawn
Comment options

Comment options

You must be logged in to vote
1 reply
@luiseduardovb
Comment options

Answer selected by bluebill1049
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
1 reply
@drewkiimon
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
10 participants