You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Adds the ability to specify a React Context that will be available to
your Components within the bootstrapping process.
Deprecates "asyncBootstrap" method on your components in favour of
"bootstrap" alternative name. Your "asyncBootstrap" methods will
still work, however you will get a deprecation warning printed.
Adds a bunch more documentation.
@@ -9,19 +9,19 @@ Provides the ability to execute async bootstrapper functions within your React e
9
9
10
10
## TOCs
11
11
12
-
-[Introduction](#introduction)
13
-
-[FAQs](#faqs)
12
+
*[Introduction](#introduction)
13
+
*[Simple Example](#simple-example)
14
14
15
15
## Introduction
16
16
17
-
This library is an abstraction of [`react-tree-walker`](https://github.com/ctrlplusb/react-tree-walker), that allows you to attach an `asyncBootstrap` method to your React "class" components.
17
+
This library is a simple implementation of [`react-tree-walker`](https://github.com/ctrlplusb/react-tree-walker), allowing you to attach a `bootstrap` method to your React/Preact "class" components. I would highly recommend you review `react-tree-walkers` documentation so as to gain more familiarity with what is being wrapped up by `react-bootstrapper`.
18
18
19
-
Within the `asyncBootstrap` you can do any asynchronous work you like (e.g. fetching data) that you like, returning a `Promise`to indicate when the asynchronous work has completed.
19
+
I have created this implementation that responds to a `bootstrap` method to allow me to have a standard implementation that would allow for interop between multiple activities requiring a bootstrapping process. For example I have create [`react-async-component`](https://github.com/ctrlplusb/react-async-component) which provides code splitting support, and [`react-jobs`](https://github.com/ctrlplusb/react-jobs) which provides a mechanism to executed data fetching. Both use this library allowing for a single bootstrapping parse to be executed for the needs of both.
Yep, not a particularly useful idea in the context of executing on the front end only, but when doing server side rendering of your react application this pattern can be extremely useful.
71
+
72
+
## API
73
+
74
+
The API is very simple at the moment, only exposing a single function.
75
+
76
+
### **bootstrapper**
77
+
78
+
The default export of the library. The function that performs the magic.
Zing. You can do anything you like. And interplay with other libaries that support `react-async-bootstrapper`, such as [`react-async-component`](https://github.com/ctrlplusb/react-async-component) which provides code splitting support.
Additional options/configuration. It currently supports the following values:
101
+
102
+
*_componentWillUnmount_: Enable this to have the `componentWillUnmount` lifecycle event be executed during the bootstrapping process. Defaults to `false`. This was added as an experimental additional flag to help with applications where they have critical disposal logic being executed within the `componentWillUnmount` lifecycle event.
103
+
104
+
***context** (`Object`, _optional_)
105
+
106
+
Any context you wish to expose to your application. This will become available to the entire application and could be useful for exposing configuration to your `bootstrap` methods.
107
+
108
+
e.g. `{ myContextItem: 'foo' }`
76
109
77
-
## FAQs
110
+
**Returns**
78
111
79
-
> Let me know if you have any questions
112
+
A `Promise` that resolves when the bootstrapping has completed.
0 commit comments