diff --git a/02 Properties/readme.md b/02 Properties/readme.md index b4764dc..265db25 100644 --- a/02 Properties/readme.md +++ b/02 Properties/readme.md @@ -1,11 +1,8 @@ # 02 Properties -In this sample we will introduce a basic React concept, handling propertiers and -callbacks. +In this sample we will introduce a basic React concept, handling properties. -We will add a _username_ property and display it in the helloWorld component, -then we will create a second component that will let the user change the default -name to another one and notify the parent control about it. +We will add a _username_ property and display it in the helloWorld component. We will take a startup point sample _01 Hello React_: diff --git a/03 State/package.json b/03 State/package.json new file mode 100644 index 0000000..1c2dfaf --- /dev/null +++ b/03 State/package.json @@ -0,0 +1,30 @@ +{ + "name": "samplereact", + "version": "1.0.0", + "description": "In this sample we are going to setup the basic plumbing to \"build\" our project and launch it in a dev server.", + "main": "index.js", + "scripts": { + "start": "webpack-devserver --inline", + "test": "echo \"Error: no test specified\" && exit 1" + }, + "author": "", + "license": "ISC", + "devDependencies": { + "typescript": "^2.0.3", + "webpack": "^1.13.2", + "webpack-devserver": "0.0.6" + }, + "dependencies": { + "@types/react": "^0.14.41", + "@types/react-dom": "^0.14.18", + "bootstrap": "^3.3.7", + "css-loader": "^0.25.0", + "file-loader": "^0.9.0", + "html-webpack-plugin": "^2.22.0", + "react": "^15.3.2", + "react-dom": "^15.3.2", + "style-loader": "^0.13.1", + "ts-loader": "^0.9.3", + "url-loader": "^0.5.7" + } +} diff --git a/03 State/readme.md b/03 State/readme.md new file mode 100644 index 0000000..a8b8249 --- /dev/null +++ b/03 State/readme.md @@ -0,0 +1,26 @@ +# 02 Properties + +In this sample we will introduce a basic React concept, handling State. + +In this case scenario we will provide a default userName but let the user update +it. + + +We will take a startup point sample _02 Properties_: + +Summary steps: + +- An app component that will hold an state, this state will contain the current +_username_ (by default assigned to "no user" value). +- This app component will render the _HelloWorld_ component. +- We will + +## Prerequisites + +Install [Node.js and npm](https://nodejs.org/en/) (v6.6.0) if they are not already installed on your computer. + +> Verify that you are running at least node v6.x.x and npm 3.x.x by running `node -v` and `npm -v` in a terminal/console window. Older versions may produce errors. + +## Steps to build it + +- Copy the content from _01 HelloReact_ and execute _npm install_. diff --git a/03 State/src/hello.tsx b/03 State/src/hello.tsx new file mode 100644 index 0000000..5636921 --- /dev/null +++ b/03 State/src/hello.tsx @@ -0,0 +1,7 @@ +import * as React from 'react'; + +export const HelloComponent = (props: {userName : string}) => { + return ( +