Skip to content

Commit b19a237

Browse files
committed
Update readme
1 parent f499814 commit b19a237

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

README.md

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
# react-json-schema
22

3-
## !! Still in Development !!
4-
5-
This library builds a React node from JSON by mapping JSON definitions to React components you expose. The interest behind making this library is to allow non-programmers whip up a view using JSON, which can be easily be stored and retrieved in a database. Use it as you'd like. (JSX not required)
3+
This library builds React elements from JSON by mapping JSON definitions to React components that you expose. The interest behind making this library is to allow non-programmers whip up a view using JSON, which can be easily be stored and retrieved in a database. Use it as you'd like. (JSX not required)
64

75
### Documentation
86

9-
1. Define your schema in JSON
10-
1. If your JSON is a string (from a request, etc.), map your components to expose them to a react-json-schema instance
11-
1. Parse the schema with react-json-schema to get a root React node
7+
The first thing you'll need to do is define your schema in JSON (or a JavaScript object literal). When doing so, there are two things to note:
8+
- A **component** key _must_ exist and be defined by a string or React Component
9+
- A **children** key _may_ exist to define sub-components
10+
11+
Next, we have to make sure that react-json-schema can create elements from component definitions. If a schema's **component** is defined by an string, you will need to expose the components included in the schema to react-json-schema. This can be done by calling `setComponentMap` with an object that has keys that match the strings in your schema, to the components are to be resolved by these strings.
12+
13+
Finally, you'll need to call `parseSchema` to create elements from your schema. Now you have React elements at your disposal!
1214

1315
Example (taken from /demo/index.jsx)
1416
```js
@@ -52,4 +54,4 @@ To run tests
5254
### Roadmap
5355

5456
* Support custom keys for children
55-
* Support native html tags as components, with the option to customize
57+
* Support native html tags as components, with the option to add custom tag definitions

0 commit comments

Comments
 (0)