Skip to content

Commit

Permalink
feat: add SSRProvider (#6031)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyletsang committed Sep 13, 2021
1 parent d3cae8d commit ca97dc8
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/SSRProvider.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { SSRProvider } from '@restart/ui/ssr';
import type { SSRProviderProps } from '@restart/ui/ssr';

export type { SSRProviderProps };

export default SSRProvider;
3 changes: 3 additions & 0 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -180,6 +180,9 @@ export type { SpinnerProps } from './Spinner';
export { default as SplitButton } from './SplitButton';
export type { SplitButtonProps } from './SplitButton';

export { default as SSRProvider } from './SSRProvider';
export type { SSRProviderProps } from './SSRProvider';

export { default as Tab } from './Tab';
export type { TabProps } from './Tab';

Expand Down
2 changes: 2 additions & 0 deletions www/src/components/SideNav.js
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ const gettingStarted = [
'theming',
'support',
'rtl',
'server-side-rendering',
];

const layout = ['grid'];
Expand Down Expand Up @@ -160,6 +161,7 @@ const nameOverrides = {
'why-react-bootstrap': 'Why React-Bootstrap',
rtl: 'RTL',
'restart-ui': '@restart/ui',
'server-side-rendering': 'Server-side Rendering',
};

function NavSection({ heading, location: { pathname }, items, path }) {
Expand Down
17 changes: 17 additions & 0 deletions www/src/pages/getting-started/server-side-rendering.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Server-side Rendering

React-Bootstrap automatically generates an `id` for some
components (such as `DropdownToggle`) if they are not provided.
This is done for accessibility purposes.

In server-side rendered applications, a `SSRProvider` must wrap
the application in order to ensure that the auto-generated ids
are consistent between the server and client.

```
import SSRProvider from 'react-bootstrap/SSRProvider';
<SSRProvider>
<App />
</SSRProvider>
```

0 comments on commit ca97dc8

Please sign in to comment.