File size: 687 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import React from 'react';
import { renderToString } from 'react-dom/server';

import { Controller } from '../controller';
import { useForm } from '../useForm';

describe('Controller with SSR', () => {
  // issue: https://github.com/react-hook-form/react-hook-form/issues/1398
  it('should render correctly with as with component', () => {
    const Component = () => {
      const { control } = useForm<{
        test: string;
      }>();

      return (
        <Controller
          defaultValue="default"
          name="test"
          render={({ field }) => <input {...field} />}
          control={control}
        />
      );
    };

    renderToString(<Component />);
  });
});