Skip to content

Commit a690852

Browse files
committed
Tiny cleanup
1 parent 04fe488 commit a690852

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

docs/safe-from-scratch.md

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Now that we have basic core tools installed, we can go about creating a basic F#
3232
```bash
3333
dotnet new console -lang F#
3434
```
35-
* Reference the Giraffe NuGet package (if you wish to use Paket, feel free to install that tool at this point).
35+
* Reference the **Giraffe** NuGet package (if you wish to use Paket, feel free to install that tool at this point).
3636
* Create a basic Giraffe application to e.g. simply return the text "Hello world!" for every request.
3737
* Run the application and confirm that it returns the expected text.
3838
```bash
@@ -43,6 +43,9 @@ dotnet run
4343
* Create a folder e.g. `client`.
4444
* Create another plain F# console application in it.
4545
* Add the Fable dotnet tool.
46+
```bash
47+
dotnet tool install fable
48+
```
4649
* To prove that Fable is installed, you should now be able to transpile the stock "Hello from F#" console app into JavaScript.
4750
```bash
4851
dotnet fable
@@ -52,7 +55,7 @@ dotnet fable
5255
Now that we have a running HTTP server and the ability to create JS from F#, we can now install the required browser libraries and tools required to host a full app in the browser.
5356

5457
* Create an `index.html` file that will be used as the launch point for the web application; it will also load the JS that is generated by Fable.
55-
* Install Vite with npm (install NPM and Node if you haven't already!).
58+
* Install **Vite** with npm (install NPM and Node if you haven't already!).
5659
```bash
5760
npm install vite
5861
```
@@ -91,22 +94,22 @@ We now spend the next few steps getting React working within the app and with F#
9194
### 3.1 [Add basic React support](https://github.com/CompositionalIT/safe-from-scratch/commit/0b331ad76fdc59442bf8024d4300ae1073a20715)
9295
Now that we have a (very) basic F# client/server app, we'll now add support for React - a front-end framework that will enable us to create responsive and rich UIs.
9396

94-
* Add the `react` and `react-dom` packages to your NPM dependencies.
95-
* Add the `@vitejs/plugin-react` and `remotedev` packages to your NPM dev dependencies.
97+
* Add the **react** and **react-dom** packages to your NPM dependencies.
98+
* Add the **@vitejs/plugin-react** and **remotedev** packages to your NPM dev dependencies.
9699
* Add react to the list of plugins in your vite config.
97100

98101
### 3.2 [Add F# React support](https://github.com/CompositionalIT/safe-from-scratch/commit/1409820300e2b09db11003c077ff3e2c82f6d9d2)
99102
Now that we have React added to our application, we can add the appropriate F# libraries such as Feliz to start to use React in a typesafe, F#-friendly manner.
100103

101-
* Add the Feliz NuGet package to the Client project.
104+
* Add the **Feliz** NuGet package to the Client project.
102105
* Remove the `<button>` element from the `index.html` - we'll be creating it dynamically with React from now on.
103106
* Add an empty `<div>` with an named `id` to the body of the `index.html`. This will be the "root" element that React will attach to from which to make HTML elements.
104107
* Using the Feliz React wrapper types, replace the contents of your `Program.fs` in the Client project so that it creates a React button that can behave as the original static HTML button.
105108
106109
### 3.3 [Add JSX support *(optional)*](https://github.com/CompositionalIT/safe-from-scratch/commit/78e4093502ec4b8281ec5c14f113e3ad14b4a6f6)
107110
This next step adds Feliz's JSX support, which allows you to embed standard React JSX code directly in your F# applications.
108111

109-
* Add the Fable.Core and Feliz.Jsx.React NuGet packages to the Client project.
112+
* Add the **Fable.Core** and **Feliz.Jsx.React** NuGet packages to the Client project.
110113
* Instead of using the Feliz F# dialect for React components (such as the `button []` element), use standard JSX code with string interpolation.
111114
* Reference `Program.jsx` instead of `Program.js` in your `index.html` file.
112115
* Run the client application using the extra flag that instructs Fable to emit `.jsx` instead of `.js` files:

0 commit comments

Comments
 (0)